Fix glossary definition data loss when editing a newly-created term#30
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a glossary editor data-loss bug caused by React selection/editor identity changing when the collaboration snapshot backfills a newly-created term’s _id. It makes term identity derive from the immutable _temp_id when present, and adds a regression test to pin this behavior.
Changes:
- Make
termKeyprefer_temp_idover_idto keep selection stable across_idbackfill. - Add a Vitest regression test ensuring term key stability during the
_idbackfill. - Bump displayed version references to
v1.3.3-betaand document the fix in the changelog.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
app/routes/_app.glossary.tsx |
Exports TermItem/termKey and updates termKey to use _temp_id for stable identity across _id backfill. |
tests/glossary-term-key.test.ts |
Adds regression coverage for termKey stability across _id backfill and key uniqueness expectations. |
README.md |
Updates version badges and beta release callouts to v1.3.3-beta. |
CHANGELOG.md |
Adds v1.3.3-beta entry describing the glossary definition data-loss fix. |
app/components/layout/Footer.tsx |
Updates the footer version string to 1.3.3-beta. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| const VERSION = "1.3.2-beta"; | ||
| const VERSION = "1.3.3-beta"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Editing a newly-created glossary term's definition could lose everything after the first character or two: the snapshot backfills the term's
_ida moment after creation, which changed the term's selection key and unmounted the open definition editor mid-edit, so only the text that reached the Y.Text before the backfill survived. The term key now derives from the immutable_temp_idwhen present, keeping the selection (and the editor) stable across the backfill. Adds a regression test pinning key-stability across the_idbackfill.