[ENG-2055] Handle duplicate node shortcuts - #1350
Open
sid597 wants to merge 3 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
…print td selector
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.
When creating a node type, walk the label for the first character not already used as a shortcut instead of leaving the shortcut unset on collision, per Matt's suggestion on ENG-2055 (if E is taken, EXPERIMENT gets X). This supersedes the blank-on-collision behavior from ENG-1741 (#1020). If every character of the label is taken, the shortcut stays unset. The taken set spans all nodes including the built-in Page/Block pseudo-nodes — their p/b are live canvas tool shortcuts — so P and B are never auto-assigned.
Adds a Shortcut column to the node type list with a warning icon when multiple nodes share a shortcut. The warning counts user nodes only, since the node menu only dispatches on user-backed nodes, and it is informational — NodeConfig continues to hard-block entering a duplicate when editing. Also fixes the optimistic local state after adding a node, which hardcoded empty shortcut/format even though the real values were persisted.
Out of scope, noted while investigating: on canvas, duplicate shortcuts all fire with the last-registered tool winning (and node shortcuts can shadow tldraw built-ins); the node menu's lookup is case-sensitive against stored values, so a lowercase-stored shortcut never fires; multi-character shortcuts are silently unreachable (and do not reserve their first character from auto-assignment); and a shortcut edit is lost if you leave the node's settings tab within ~350ms of typing (pre-existing debounce cancel on unmount, which the new column now makes visible).