fix(default-app): Make charm name updates reactive in list #2016
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where the Default Charm List does not update charm names when they are changed from within the charm (e.g., editing a Note's title).
Problem
When you open a Note from the Default Charm List and change its title, the title does not update in the list when you navigate back. The list continues to show the old name.
Root Cause: The UI was directly accessing
charm?.[NAME]inside a.map()function, which doesn't create a reactive binding. When a charm's title changes internally, it updates that charm's[NAME]property, but since theallCharmsarray reference itself doesn't change, the reactive system doesn't know to re-render.Solution
This PR implements the same reactive pattern already used in
chatbot-list-view.tsx:liftfrom commontoolsgetCharmNamelift function to extract charm names reactivelygetCharmName({ charm })in the table rendering instead of direct property accessThis creates a proper reactive dependency so when any charm's
[NAME]property changes, the UI automatically re-renders that specific table row.Changes
File:
packages/patterns/default-app.tsxliftimport (line 6)getCharmNamelift function (lines 102-104)getCharmName({ charm })instead ofcharm?.[NAME](line 185)Testing
To test this fix:
deno task dev-local(shell) and the toolshed backendReferences
packages/patterns/chatbot-list-view.tsx:221-223docs/common/RECIPES.mdSummary by cubic
Fixed non-reactive charm name rendering in the Default Charm List. Renaming a charm now updates its name in the list immediately.
Written for commit 28bd690. Summary will update automatically on new commits.