Repository navigation
fix(hierarchical-document-list): update react-sortable-tree to 7.1.0 - #2253
pedrobonamin wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
✅ E2E Tests🟢 54 passed • (⚪ 2 skipped) • view full report • view run Studio: https://plugins-e2e-test-studio-qenqi3f7g.sanity.dev Datasets: |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ed89a41. Configure here.
🦋 Changeset detectedLatest commit: 0b221fe 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 |
… in the tree (#2246) <!-- CURSOR_AGENT_PR_BODY_BEGIN --> First of three stacked PRs: 1. **This PR:** pin `@nosferatu500/react-sortable-tree` to 5.0.0 and fix same-level moves. 2. #2251: a Playwright suite covering reordering, nesting, un-nesting and moving a whole subtree. 3. #2253: upgrade to 7.1.0, checked by that suite. ## Summary https://github.com/user-attachments/assets/d5bee535-58cc-4fd9-a93d-feadfe6cc0a4 Two separate bugs broke drag-and-drop in the tree. **Nesting saved the item at the top level** (commit 1). Renovate moved the plugin from `^5.0.0` to `^5.1.0` in #1881, and 5.1.0 has a regression in `insertNode`. Its recursive helper spreads `...params`, which carries `isPseudoRoot: true` into every nested level, so `onMoveNode` always receives `nextParentNode: null`. 5.0.0 passes explicit arguments, and 7.1.0 fixes it with `isPseudoRoot: false`. This pins the dependency to exactly `5.0.0`. The lockfile change is hand-edited to just the library and its `virtua` dependency (0.50.6 → 0.48.8, only used by this library), because a regular install re-resolves the Studio `next` overrides. `pnpm install --frozen-lockfile` accepts it, including the supply-chain checks. **Moving an item up or down within its level snapped it back** (commit 2). This bug isn't version-specific. Since 9113861, `getNodeKey` returns the row's `_key`, so tree paths are made of keys rather than positions. `canDrop` rejected a drop when the new path started with the old one, which is always true for a move within the same level (`['charlie']` before and after). It now only rejects drops whose new parents include the dragged row itself. This supersedes #2245, which worked around the missing parent but left same-level moves broken. ## Testing #2251 adds a Playwright suite covering moving an item up and down, nesting, un-nesting and moving an item with its children. It passes on this branch in Chromium and Firefox. With `main`'s code (5.1.0 and the old `canDrop`), all five scenarios fail in Chromium. `pnpm build`, `pnpm lint`, `pnpm knip` and the plugin's Vitest project pass. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-010edcd6-3b41-43cc-a8a6-2b950822315b?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-010edcd6-3b41-43cc-a8a6-2b950822315b&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Dependency pin and lockfile-only transitive changes; restores prior nesting behavior without touching plugin application logic. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ae56fa1. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
2aa8385 to
a2626d9
Compare
a2626d9 to
2f364ef
Compare
…wright Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
…irefox Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
2f364ef to
0b221fe
Compare
…wright (#2251) <!-- CURSOR_AGENT_PR_BODY_BEGIN --> Second of three stacked PRs, on top of #2246: 1. #2246: pin `@nosferatu500/react-sortable-tree` to 5.0.0 and fix same-level moves. 2. **This PR:** a Playwright suite for the tree's drag-and-drop. 3. #2253: upgrade to 7.1.0, checked by this suite. ## Summary This wires `@sanity/hierarchical-document-list` into `dev/e2e-studio`, adding a `hierarchyBook` schema, the plugin's `hierarchy.tree` type, and a **Hierarchy** structure item for the `hierarchy-e2e-tree` document in both workspaces. It also adds a spec that drags rows by their handle with real mouse movement. | Test | Seeded tree | Drag | Expected | | --- | --- | --- | --- | | moves an item up within the same level | `alpha, bravo, charlie` | charlie over alpha | `charlie, alpha, bravo` | | moves an item down within the same level | `alpha, bravo, charlie` | alpha over charlie | `bravo, charlie, alpha` | | nests an item under the item above it | `alpha, bravo, charlie` | bravo 60px right | `alpha[bravo], charlie` | | moves a nested item out to the root | `alpha[bravo], charlie` | bravo 30px left | `alpha, bravo, charlie` | | moves an item together with its nested children | `alpha, bravo[delta], charlie` | bravo over alpha | `bravo[delta], alpha, charlie` | [video.webm](https://github.com/user-attachments/assets/dc2e4819-dca0-441f-b676-6e977e950db6) [video.webm](https://github.com/user-attachments/assets/351b3554-5cf7-4a00-97e3-b796dec34043) [video.webm](https://github.com/user-attachments/assets/da746195-1d57-40a9-a468-1ad8487639c5) [video.webm](https://github.com/user-attachments/assets/fdd143c7-c642-4fd1-8b24-3014f7d9221e) Each test seeds the books and the tree through the Content Lake API and deletes them in `finally`. Every test checks both the saved document (sibling order plus `parent`) and the rendered rows (order plus indentation). The tests share one tree document, so the describe block runs serially. The structure tool now has a custom structure: all document type lists, then the hierarchy item. The other suites navigate with intents, so they aren't affected. ## Testing Run locally against ephemeral datasets: - This spec: 5/5 pass in Chromium and 5/5 in Firefox. - The whole e2e suite: 56 passed, 4.3 minutes. - Against `main`'s code (react-sortable-tree 5.1.0 and the old `canDrop`), all five scenarios fail in Chromium. For example, the move-up test expects `charlie, alpha, bravo` and gets `alpha, bravo, charlie`. `pnpm lint`, `pnpm knip`, the e2e studio build and `tsc` for `e2e/` pass. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-010edcd6-3b41-43cc-a8a6-2b950822315b?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-010edcd6-3b41-43cc-a8a6-2b950822315b&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Changes are limited to the e2e studio, Playwright tests, and documentation; no production plugin runtime behavior is modified in this PR. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 326b58a. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>

Third of three stacked PRs, on top of #2251:
@nosferatu500/react-sortable-treeto 5.0.0 and fix same-level moves.Summary
Changes needed to upgrade from 5.0.0 to 7.1.0, following the library's changelog:
react-dndpeer for the maintained forks.react-dnd/react-dnd-html5-backend16 become@nosferatu500/react-dnd/@nosferatu500/react-dnd-html5-backend^19.2, including theDndProviderandHTML5Backendimports inTreeEditor.@nosferatu500/react-sortable-tree/style.css(with acss.d.tsmodule declaration, likesanity-plugin-latex-input). Screenshots of the e2e tree on 5.0.0 and 7.1.0 look the same, both at rest and mid-drag.slideRegionSize: removed in 6.0, so it's dropped fromgetCommonTreeProps.TreeItemgeneric.LocalTreeItemis nowTreeItem<EnhancedTreeItem>, andgetCommonTreeProps,getTreeHeightandgetNodeKeycarry that type, soSortableTreeinfers it.The lockfile was resolved through a local registry proxy that serves the locked
6.21.0-next.1as the Studio packages'nextdist-tag, as described inAGENTS.md. The unrelated peer-suffix toggle (@vitejs/devtools/oxc-transform-reactondebug-preview-url-secret-plugin) and@opentelemetrydeprecation-note changes were reverted. What remains is the library, the@nosferatu500drag-and-drop packages,virtua0.50.6, and the removal ofreact-dnd16 and what only it used (dnd-core,@react-dnd/*,redux4).pnpm install --frozen-lockfilepasses, including the supply-chain checks, and the lockfile has nolocalhostortarball:entries.Upward drags skipped in Playwright's Firefox
With 7.1.0, Playwright's Firefox often drops an upward drag on the row that was under the pointer before the rows shifted. The library's
onMoveNodethen reports a position one row short, or doesn't fire. Repeating the same upward drag 8 times gave:The same moves were checked by hand in a real Firefox and work correctly, so this is an artifact of Playwright's Firefox drag emulation. The two upward-drag tests ("moves an item up within the same level" and "moves an item together with its nested children") are skipped in Firefox only, with a comment explaining why. They still run in Chromium. Moving down, nesting and un-nesting run in both browsers.
Testing
pnpm build(54/54),pnpm lint,pnpm knipand the plugin's Vitest project pass.Note
Medium Risk
Changes core tree drag-and-drop behavior and dependencies; upward reordering is flaky in Firefox per author testing, while Chromium looks fine.
Reviewed by Cursor Bugbot for commit ed89a41. Configure here.