Skip to content

Commit 04c6a6d

Browse files
committed
Rename ReactiveResult to ReactiveQuery and usages
Change ReactiveResult types and variables to ReactiveQuery across the desktop app to reflect the new abstraction for query-like reactive responses. Update API and state accessors and corresponding variable names (e.g. projectResult -> projectQuery, commitResult -> commitQuery, messageUpdateResult -> messageUpdateQuery, topBranchResult -> topBranchQuery) and adjust property accessors from .current/.data to .result/.response where appropriate. This clarifies intent between Redux-style results and query-style responses, reduces ambiguity in the codebase, and aligns variable names with the updated butlerModule types and conventions.
1 parent 0c5817a commit 04c6a6d

File tree

85 files changed

+399
-383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+399
-383
lines changed

apps/desktop/src/components/AnalyticsMonitor.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ attached to posthog events.
1919
const projectsService = inject(PROJECTS_SERVICE);
2020
const settingsService = inject(SETTINGS_SERVICE);
2121
22-
const projectResult = $derived(projectsService.getProject(projectId));
22+
const projectQuery = $derived(projectsService.getProject(projectId));
2323
const globalState = uiState.global;
2424
const projectState = $derived(uiState.project(projectId));
2525
@@ -51,7 +51,7 @@ attached to posthog events.
5151
});
5252
5353
$effect(() => {
54-
const project = projectResult.current.data;
54+
const project = projectQuery.response;
5555
if (project) {
5656
eventContext.update({
5757
forcePushAllowed: project.ok_with_force_push,

apps/desktop/src/components/BaseBranchSwitch.svelte

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
1010
const stackService = inject(STACK_SERVICE);
1111
const baseBranchService = inject(BASE_BRANCH_SERVICE);
12-
const baseBranchResponse = $derived(baseBranchService.baseBranch(projectId));
13-
const baseBranch = $derived(baseBranchResponse.current.data);
14-
const remoteBranchesResponse = $derived(baseBranchService.remoteBranches(projectId));
12+
const baseBranchQuery = $derived(baseBranchService.baseBranch(projectId));
13+
const baseBranch = $derived(baseBranchQuery.response);
14+
const remoteBranchesQuery = $derived(baseBranchService.remoteBranches(projectId));
1515
const [setBaseBranchTarget, targetBranchSwitch] = baseBranchService.setTarget;
1616
1717
let selectedBranch = $derived(baseBranch?.branchName);
1818
let selectedRemote = $derived(baseBranch?.actualPushRemoteName());
1919
20-
const stacksResult = $derived(stackService.stacks(projectId));
21-
const stackCount = $derived(stacksResult.current.data?.length);
20+
const stacksQuery = $derived(stackService.stacks(projectId));
21+
const stackCount = $derived(stacksQuery.response?.length);
2222
const targetChangeDisabled = $derived(!!(stackCount && stackCount > 0));
2323
2424
function uniqueRemotes(remoteBranches: { name: string }[]) {
@@ -42,15 +42,15 @@
4242
}
4343
</script>
4444

45-
{#if remoteBranchesResponse.current.isLoading}
45+
{#if remoteBranchesQuery.result.isLoading}
4646
<InfoMessage filled outlined={false} icon="info">
4747
{#snippet content()}
4848
Loading remote branches...
4949
{/snippet}
5050
</InfoMessage>
51-
{:else if remoteBranchesResponse.current.isSuccess}
52-
{@const remoteBranches = remoteBranchesResponse.current.data}
53-
{#if remoteBranches.length > 0}
51+
{:else if remoteBranchesQuery.result.isSuccess}
52+
{@const remoteBranches = remoteBranchesQuery.response}
53+
{#if remoteBranches && remoteBranches.length > 0}
5454
<SectionCard>
5555
{#snippet title()}
5656
Remote configuration
@@ -120,7 +120,7 @@
120120
{/if}
121121
</SectionCard>
122122
{/if}
123-
{:else if remoteBranchesResponse.current.isError}
123+
{:else if remoteBranchesQuery.result.isError}
124124
<InfoMessage filled outlined={true} style="error" icon="error">
125125
{#snippet title()}
126126
We got an error trying to list your remote branches

apps/desktop/src/components/BranchCard.svelte

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,7 @@
164164
? rulesService.aiRuleForStack({ projectId, stackId: args.stackId })
165165
: undefined}
166166
{@const codegenRuleHandler = args.stackId
167-
? new CodegenRuleDropHandler(
168-
projectId,
169-
args.stackId,
170-
rulesService,
171-
!!rule?.current.data?.rule
172-
)
167+
? new CodegenRuleDropHandler(projectId, args.stackId, rulesService, !!rule?.response?.rule)
173168
: undefined}
174169

175170
<Dropzone
@@ -242,8 +237,8 @@
242237
<span class="branch-header__divider">•</span>
243238
<div class="branch-header__review-badges">
244239
{#if args.prNumber}
245-
{@const prResult = prService?.get(args.prNumber, { forceRefetch: true })}
246-
{@const pr = prResult?.current.data}
240+
{@const prQuery = prService?.get(args.prNumber, { forceRefetch: true })}
241+
{@const pr = prQuery?.response}
247242
<ReviewBadge type={prUnit?.abbr} number={args.prNumber} status="unknown" />
248243
{#if pr && !pr.closedAt && forge.current.checks && pr.state === 'open'}
249244
<ChecksPolling
@@ -352,13 +347,13 @@
352347
? rulesService.aiRuleForStack({ projectId, stackId: args.stackId })
353348
: undefined}
354349
{#if rule}
355-
<ReduxResult result={rule?.current} {projectId} stackId={args.stackId}>
350+
<ReduxResult result={rule?.result} {projectId} stackId={args.stackId}>
356351
{#snippet children({ rule }, { projectId, stackId })}
357352
{#if rule}
358353
{@const sessionId = (rule.filters[0]! as RuleFilter & { type: 'claudeCodeSessionId' })
359354
.subject}
360355
{@const sessionDetails = claudeCodeService.sessionDetails(projectId, sessionId)}
361-
<ReduxResult result={sessionDetails.current} {projectId} {stackId}>
356+
<ReduxResult result={sessionDetails.result} {projectId} {stackId}>
362357
{#snippet children(sessionDetails, { projectId, stackId: _stackId })}
363358
<ClaudeSessionDescriptor {projectId} {sessionId}>
364359
{#snippet loading()}

apps/desktop/src/components/BranchCommitList.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@
108108
stackService.upstreamCommits(projectId, stackId, branchName)
109109
);
110110
111-
const baseBranchResponse = $derived(baseBranchService.baseBranch(projectId));
112-
const base = $derived(baseBranchResponse.current.data);
111+
const baseBranchQuery = $derived(baseBranchService.baseBranch(projectId));
112+
const base = $derived(baseBranchQuery.response);
113113
const baseSha = $derived(base?.baseSha);
114114
115115
let integrationModal = $state<Modal>();
@@ -237,7 +237,7 @@
237237
<ReduxResult
238238
{stackId}
239239
{projectId}
240-
result={combineResults(upstreamOnlyCommits.current, localAndRemoteCommits.current)}
240+
result={combineResults(upstreamOnlyCommits.result, localAndRemoteCommits.result)}
241241
>
242242
{#snippet children([upstreamOnlyCommits, localAndRemoteCommits], { stackId })}
243243
{@const hasRemoteCommits = upstreamOnlyCommits.length > 0}

apps/desktop/src/components/BranchExplorer.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@
7373
uiState
7474
);
7575
76-
const branchesResult = $derived(branchService.list(projectId));
76+
const branchesQuery = $derived(branchService.list(projectId));
7777
const combined = $derived(
78-
combineBranchesAndPrs(prs.current, branchesResult.current.data || [], selectedOption)
78+
combineBranchesAndPrs(prs.current, branchesQuery.response || [], selectedOption)
7979
);
8080
8181
const groupedBranches = $derived(groupBranches(combined, forgeUser));

apps/desktop/src/components/BranchHeaderContextMenu.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
return stackService.fetchUnstackedCommits(projectId, contextData.branch.name);
8888
}
8989
90-
const commits = $derived(allCommits?.current.data);
90+
const commits = $derived(allCommits?.response);
9191
const branchType = $derived(commits?.at(0)?.state.type || 'LocalOnly');
9292
const isConflicted = $derived(commits?.some((commit) => commit.hasConflicts) ?? false);
9393
@@ -273,7 +273,7 @@
273273
<ContextMenuSection>
274274
{#if stackId && first && $codegenEnabled}
275275
{@const rule = rulesService.aiRuleForStack({ projectId, stackId })}
276-
{#if !rule.current.data?.rule}
276+
{#if !rule.response?.rule}
277277
<ContextMenuItem
278278
label="Start agent session"
279279
icon="agents-tab"
@@ -339,8 +339,8 @@
339339
</ContextMenuSection>
340340
{/if}
341341
{#if prNumber}
342-
{@const prResult = forge.current.prService?.get(prNumber)}
343-
<ReduxResult {projectId} {stackId} result={prResult?.current}>
342+
{@const prQuery = forge.current.prService?.get(prNumber)}
343+
<ReduxResult {projectId} {stackId} result={prQuery?.result}>
344344
{#snippet children(pr)}
345345
<ContextMenuSection>
346346
<ContextMenuItemSubmenu label="Pull Request" icon="pr">

apps/desktop/src/components/BranchIntegrationModal.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
branchName
3838
);
3939
40-
let editableSteps = $derived(initialIntegrationSteps.current?.data ?? []);
40+
let editableSteps = $derived(initialIntegrationSteps.response ?? []);
4141
4242
// Constants
4343
const FLIP_ANIMATION_DURATION = 150;
@@ -369,8 +369,8 @@
369369
{@const isSquashStep = step.type === 'squash'}
370370
{@const isIndividualStep = step.type === 'pick' || step.type === 'skip'}
371371
{#if isSquashStep}
372-
{@const commitsResult = stackService.commitsByIds(projectId, stackId, step.subject.commits)}
373-
<ReduxResult {projectId} result={commitsResult.current}>
372+
{@const commitsQuery = stackService.commitsByIds(projectId, stackId, step.subject.commits)}
373+
<ReduxResult {projectId} result={commitsQuery.result}>
374374
{#snippet children(commits)}
375375
{#each commits as commit, commitIndex (commit.id)}
376376
{@const isLastCommit = commitIndex === commits.length - 1}
@@ -394,7 +394,7 @@
394394
</ReduxResult>
395395
{:else if isIndividualStep}
396396
{@const commitDetails = stackService.commitById(projectId, stackId, step.subject.commitId)}
397-
<ReduxResult {projectId} result={commitDetails.current}>
397+
<ReduxResult {projectId} result={commitDetails.result}>
398398
{#snippet children(commit)}
399399
{@const isSkipStep = step.type === 'skip'}
400400
<div class="branch-integration__commit" class:skipped={isSkipStep}>
@@ -412,10 +412,10 @@
412412
{:else if step.type === 'pickUpstream'}
413413
{@const commitDetails = stackService.commitDetails(projectId, step.subject.upstreamCommitId)}
414414
{@const localCommitDetails = stackService.commitById(projectId, stackId, step.subject.commitId)}
415-
<ReduxResult {projectId} result={commitDetails.current}>
415+
<ReduxResult {projectId} result={commitDetails.result}>
416416
{#snippet loading()}
417417
<!-- Show local commit data while loading upstream commit to prevent flickering -->
418-
<ReduxResult {projectId} result={localCommitDetails.current}>
418+
<ReduxResult {projectId} result={localCommitDetails.result}>
419419
{#snippet children(localCommit)}
420420
<div class="branch-integration__commit">
421421
{@render commitItemTemplate(

apps/desktop/src/components/BranchList.svelte

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
);
105105
106106
$effect(() => {
107-
if (selectedCommit && selectedCommit.current.status === QueryStatus.rejected) {
107+
if (selectedCommit && selectedCommit.result.status === QueryStatus.rejected) {
108108
const branchName = selection.current?.branchName;
109109
if (branchName) {
110110
selection.set({ branchName, commitId: undefined });
@@ -129,20 +129,20 @@
129129
{@const branchName = branch.name}
130130
{@const localAndRemoteCommits = stackService.commits(projectId, stackId, branchName)}
131131
{@const upstreamOnlyCommits = stackService.upstreamCommits(projectId, stackId, branchName)}
132-
{@const branchDetailsResult = stackService.branchDetails(projectId, stackId, branchName)}
133-
{@const commitResult = stackService.commitAt(projectId, stackId, branchName, 0)}
134-
{@const prResult = branch.prNumber ? forge.current.prService?.get(branch.prNumber) : undefined}
132+
{@const branchDetailsQuery = stackService.branchDetails(projectId, stackId, branchName)}
133+
{@const commitQuery = stackService.commitAt(projectId, stackId, branchName, 0)}
134+
{@const prQuery = branch.prNumber ? forge.current.prService?.get(branch.prNumber) : undefined}
135135

136136
{@const first = i === 0}
137137

138138
<ReduxResult
139139
{projectId}
140140
{stackId}
141141
result={combineResults(
142-
localAndRemoteCommits.current,
143-
upstreamOnlyCommits.current,
144-
branchDetailsResult.current,
145-
commitResult.current
142+
localAndRemoteCommits.result,
143+
upstreamOnlyCommits.result,
144+
branchDetailsQuery.result,
145+
commitQuery.result
146146
)}
147147
>
148148
{#snippet children([localAndRemoteCommits, upstreamOnlyCommits, branchDetails, commit])}
@@ -231,7 +231,7 @@
231231
{`Create ${forge.current.name === 'gitlab' ? 'MR' : 'PR'}`}
232232
</Button>
233233
{:else}
234-
{@const prUrl = prResult?.current.data?.htmlUrl}
234+
{@const prUrl = prQuery?.response?.htmlUrl}
235235
<Button
236236
size="tag"
237237
kind="outline"

apps/desktop/src/components/BranchRenameModal.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
const { projectId, stackId, laneId, branchName, isPushed }: BranchRenameModalProps = $props();
1717
const stackService = inject(STACK_SERVICE);
1818
19-
const [renameBranch, renameResult] = stackService.updateBranchName;
19+
const [renameBranch, renameQuery] = stackService.updateBranchName;
2020
2121
let newName: string | undefined = $state();
2222
let modal: Modal | undefined = $state();
@@ -61,7 +61,7 @@
6161
style="pop"
6262
type="submit"
6363
disabled={!newName}
64-
loading={renameResult.current.isLoading}>Rename</Button
64+
loading={renameQuery.current.isLoading}>Rename</Button
6565
>
6666
{/snippet}
6767
</Modal>

apps/desktop/src/components/BranchView.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
4545
const stackService = inject(STACK_SERVICE);
4646
47-
const branchResult = $derived(stackService.branchDetails(projectId, stackId, branchName));
48-
const branchesResult = $derived(stackService.branches(projectId, stackId));
49-
const topCommitResult = $derived(stackService.commitAt(projectId, stackId, branchName, 0));
47+
const branchQuery = $derived(stackService.branchDetails(projectId, stackId, branchName));
48+
const branchesQuery = $derived(stackService.branches(projectId, stackId));
49+
const topCommitQuery = $derived(stackService.commitAt(projectId, stackId, branchName, 0));
5050
5151
let renameBranchModal = $state<BranchRenameModal>();
5252
let deleteBranchModal = $state<DeleteBranchModal>();
@@ -56,7 +56,7 @@
5656
{stackId}
5757
{projectId}
5858
{onerror}
59-
result={combineResults(branchesResult.current, branchResult.current, topCommitResult.current)}
59+
result={combineResults(branchesQuery.result, branchQuery.result, topCommitQuery.result)}
6060
>
6161
{#snippet children([branches, branch, topCommit], { stackId, projectId })}
6262
{@const hasCommits = !!topCommit || branch.upstreamCommits.length > 0}

0 commit comments

Comments
 (0)