Conversation
- Store canvas page UID on editor instance when mounting - Update relation creation to use canvas page UID instead of main page UID - Fixes issue where relations created from canvas in right sidebar incorrectly use main page title Co-authored-by: doantranghp2000 <doantranghp2000@gmail.com>
|
Cursor Agent can help with this pull request. Just |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
- Add canvasPageUid to DiscourseContextType instead of monkey-patching editor - Store canvas page UID in discourseContext on mount - Use discourseContext.canvasPageUid in relation creation - Removes @ts-expect-error comments and follows existing patterns Co-authored-by: Trang Doan <trangdoan982@users.noreply.github.com>
- Replace single canvasPageUid with editorToPageUid WeakMap - Maps each editor instance to its specific canvas page UID - Fixes issue where multiple canvases in sidebars would share wrong page UID - Ensures relation creation uses correct canvas page even with multiple open Co-authored-by: Trang Doan <trangdoan982@users.noreply.github.com>
mdroidian
left a comment
There was a problem hiding this comment.
Could we just pass pageUid to createAllRelationShapeUtils instead of storing it? This would be more direct and easier to debug.
Another alternative would be grabbing it from the DOM if the relation shape gives you that (I'm guessing it would) because the page uid's are stored in the h1 wrapper's now.
| const canvasPageUid = discourseContext.editorToPageUid.get( | ||
| this.editor, | ||
| ); | ||
| const parentUid = canvasPageUid || getCurrentPageUid(); |
There was a problem hiding this comment.
We probably don't want getCurrentPageID because this would return false if we were on the sidebar, and that would be a no-good bug. If there is no canvas page ID, we should probably throw an alert and an internalError.
https://www.loom.com/share/c409751c64654304b8ba05c64c7168c0
Fixes auto-generated page title using the main page instead of the canvas page when the canvas is in the right sidebar.
The relation creation logic was incorrectly retrieving the main page's UID via
getCurrentPageUid()instead of the active canvas page's UID. This PR stores the canvas page UID on the editor instance when it mounts and uses this stored UID for relation title generation.Linear Issue: ENG-1123