-
Notifications
You must be signed in to change notification settings - Fork 2
Create new sibling editing flow when moving past rightmost node #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new sibling editing flow that replaces the previous select+A combo with automatic sibling creation when navigating past the rightmost node. When the right arrow is pressed on the last continuation, it now opens the edit menu with a draft node and only creates the sibling when the edit is saved.
Key changes:
- Track pending sibling creation state instead of immediately creating nodes
- Open edit menu with draft node when moving past rightmost continuation
- Add
createSiblingNodehelper to manage sibling creation, selection updates, and metadata synchronization
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| client/interface/hooks/useStoryTree.ts | Adds createSiblingNode helper function for managing sibling node creation and state updates |
| client/interface/Interface.tsx | Implements pending sibling state tracking and draft node editing flow with right arrow navigation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| return parent.continuations[newIndex]; | ||
| }, | ||
| [storyTree, currentTreeKey, setTrees], |
Copilot
AI
Sep 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dependency array is missing touchStoryUpdated which is called within the createSiblingNode function. This could lead to stale closure issues if touchStoryUpdated is redefined.
| [storyTree, currentTreeKey, setTrees], | |
| [storyTree, currentTreeKey, setTrees, touchStoryUpdated], |
| depth: currentDepth, | ||
| pathIds, | ||
| draft: { | ||
| id: `draft-${Date.now().toString(36)}`, |
Copilot
AI
Sep 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Date.now().toString(36) for ID generation could potentially create collisions in rapid succession. Consider using a more robust ID generation method like crypto.randomUUID() or a dedicated UUID library.
| id: `draft-${Date.now().toString(36)}`, | |
| id: `draft-${crypto.randomUUID()}`, |
| } | ||
|
|
||
| return { | ||
| id: Math.random().toString(36).substring(2, 15), |
Copilot
AI
Sep 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ID generation method using Math.random() is inconsistent with the draft ID generation above and could potentially create collisions. Consider using a consistent, more robust ID generation method throughout the codebase.
Summary
createSiblingNodehelper on the story tree hook to append siblings, update selection, and keep metadata in syncTesting
https://chatgpt.com/codex/tasks/task_e_68cf1f2317048327a73c1ca3ec15e86a