Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 0 important · 0 nits · head bd1e27ef
- blocker (process): the PR body has no
fails without the fix:line naming the regression test. Add one, for examplefails without the fix: packages/core/src/figma/parseFigmaRef.test.ts › "uses the branch key of a branch URL, …"(it currently returnsMainKey123). That line is the only thing blocking this.
Scope
I read the full diff (parseFigmaRef.ts and its test). The regex change is correct: the optional /branch/<key> group wins over the file key, the bare /branch name still resolves to the main key, and node-id handling is unchanged. parseFigmaRef is the only Figma URL parser in the repo (the CLI goes through it), so there are no sibling sites to update. CI was still running at review time. The finished checks (captures, comments, preview-regression, player perf) are green.
Contributor
Author
|
Added the |
This branch has not been deployed
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.
What
parseFigmaRefnow returns the branch key for a Figma branch URL.A branch link has the shape
https://www.figma.com/design/<fileKey>/branch/<branchKey>/<Name>. The REST API serves a branch under its own key (GET /v1/files/:key, where the key "can be a file key or branch key", per the file endpoints docs), butFILE_KEY_REstopped at the first segment, so a branch link resolved to the main file. Every later call (/files/:key/nodes, images, variables) then read the main file, and a frame that only exists on the branch came back as missing, or a frame edited on the branch was imported in its main-file state.How
FILE_KEY_REoptionally matches a following/branch/<key>segment, and the parser uses that key when it is present. Non-branch URLs, thefileKey:nodeIdshorthand and node-id handling are unchanged; a file whose name is literallybranch(no key after it) still resolves to the main key.Test
Two new cases in
packages/core/src/figma/parseFigmaRef.test.ts: a/design/.../branch/...URL with a node id and a/file/.../branch/...URL without one both return the branch key, and/design/<key>/branchkeeps the file key. The first case fails before the change (it returnsMainKey123) and passes after; the whole file passes (8 tests). Formatted with oxfmt 0.41.0.fails without the fix:
packages/core/src/figma/parseFigmaRef.test.ts› "uses the branch key of a branch URL, which is the key the REST API serves the branch under" (returnsMainKey123instead of the branch key)This PR was prepared with AI assistance; I reviewed the change and ran the tests.