Use CanvasContext / url as source of truth - NOREF#544
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The state was a bit hard to follow between the data provided by the canvas context and the props passed down explicitly. Additionally, it seems that we can use nextJS native hooks to get / set the canvas index, allowing us to remove some of the use of window APIs. Disclosure - the updates to useCanvasContext were generated using gemini. Everything else is artisinal. Also, note the use of `scroll: false` in `router.push`. That was a manual update to prevent the focus from being disrupted when paging to the next canvas.
sarangj
commented
Mar 26, 2026
sarangj
commented
Mar 26, 2026
| canvasIndex | ||
| ); | ||
| } | ||
| }, [canvasIndex, uv]); |
Contributor
Author
There was a problem hiding this comment.
I believe just using canvasIndex as a dep here removes the need to track the last canvas index ref.
keithbauer
approved these changes
Mar 26, 2026
keithbauer
left a comment
Member
There was a problem hiding this comment.
nice, looks good in the vercel preview
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.
Ticket:
This PR does the following:
Some followup cleanup as I've learned a bit more about nextJS / context
The state was a bit hard to follow between the data provided by the
canvas context and the props passed down explicitly. Additionally, it
seems that we can use nextJS native hooks to get / set the canvas index,
allowing us to remove some of the use of window APIs.
Disclosure - the updates to useCanvasContext were generated using
gemini. Everything else is artisanal. Also, note the use of
scroll: falseinrouter.push. That was a manual update to prevent the focusfrom being disrupted when paging to the next canvas.
Open questions
How has this been tested? How should a reviewer test this?
Accessibility concerns or updates
Checklist: