Skip to content

fix(desktop): capture context name before awaits in handleDelete#490

Merged
skevetter merged 1 commit into
mainfrom
kind-cobra
Jun 5, 2026
Merged

fix(desktop): capture context name before awaits in handleDelete#490
skevetter merged 1 commit into
mainfrom
kind-cobra

Conversation

@skevetter

Copy link
Copy Markdown
Contributor

Summary

  • Fixes the intermittent Failed to delete context: Cannot read properties of undefined (reading 'name') error when deleting a non-default context.
  • Root cause: handleDelete in ContextSheet.svelte read context.name after await refreshContexts(). The context prop is reactive — derived in ContextsPage.svelte via $contexts.find(...). Once the deleted context leaves the store, that derived returns undefined, nulling the prop, so the success line context.name throws. The deletion actually succeeded, so the user saw a false failure toast.
  • Intermittent because it's a Svelte 5 reactive-timing race on whether the derived/prop propagation lands before the success line runs.
  • Fix: hoist const name = context.name before the awaits and use it throughout.

The reactive `context` prop is derived from the contexts store. After
refreshContexts() removes the deleted context, the derived prop becomes
undefined and reading context.name on the success line throws, showing a
false "Failed to delete context" toast even though deletion succeeded.
Hoist the name into a local before the awaits.
@netlify

netlify Bot commented Jun 5, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 7c334a2
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a2303ba21adcb0008ade45d

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@skevetter, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 5 minutes and 8 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9bac07ba-aeca-4ab5-8b41-539ca909ad8b

📥 Commits

Reviewing files that changed from the base of the PR and between 4fe8ca9 and 7c334a2.

📒 Files selected for processing (1)
  • desktop/src/renderer/src/lib/components/context/ContextSheet.svelte

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@skevetter
skevetter merged commit ae491e3 into main Jun 5, 2026
20 checks passed
@skevetter
skevetter deleted the kind-cobra branch June 5, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant