Fix token set folder drag-reorder scrambling order when folders are expanded#3828
Draft
Fix token set folder drag-reorder scrambling order when folders are expanded#3828
Conversation
🦋 Changeset detectedLatest commit: 7dcb0a8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 16 |
TIP This summary will be updated as you push new changes. Give us feedback
Contributor
|
|
Contributor
|
Commit SHA:ef1cbd26915901b63020f228e78e23567a09e5af Test coverage results 🧪
|
Agent-Logs-Url: https://github.com/tokens-studio/figma-plugin/sessions/94e8cf0f-62e3-4fa7-a1f4-b05b1692c65b Co-authored-by: akshay-gupta7 <9948167+akshay-gupta7@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix token set folder drag-reorder issue with expanded folders
Fix token set folder drag-reorder scrambling order when folders are expanded
Mar 31, 2026
Contributor
|
Commit SHA:ef1cbd26915901b63020f228e78e23567a09e5af |
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.
Dragging a folder to reorder it produced a scrambled result when folders were expanded. The bug worsened when folder structures had been modified by renaming sets into existing folders.
Root Cause
ensureFolderIsTogetherused a delta-based move that only repositioned direct children (parent === value.path). Grandchildren were left in place, becoming orphaned at the top of the list.Changes
ensureFolderIsTogether: Replace delta-based child movement with a grouping approach — collect all descendants (parent === pathorparent.startsWith(path + '/')), strip them from their scattered positions, and re-insert them contiguously after the folder in their original relative order.findOrderableTargetIndexesInTokenSetTreeList: FixstartsWith(path)→parent === path || startsWith(path + '/')to avoid falsely counting children of prefix-matching sibling folders (e.g.themes2counted as child ofthemes).TokenSetTreehandleReorder: SamestartsWithboundary fix in the collapsed-folder children lookup.