Skip to content

Fix 404 from wallpaper Sort By when a synthetic tile is on the desktop - #370

Merged
AllTerrainDeveloper merged 1 commit into
trunkfrom
fix/wallpaper-sort-by-synthetic-placement-404
Jul 18, 2026
Merged

Fix 404 from wallpaper Sort By when a synthetic tile is on the desktop#370
AllTerrainDeveloper merged 1 commit into
trunkfrom
fix/wallpaper-sort-by-synthetic-placement-404

Conversation

@AllTerrainDeveloper

@AllTerrainDeveloper AllTerrainDeveloper commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Right-clicking the wallpaper → Sort by → any order threw a 404 whenever a synthetic tile (a dock item promoted to the desktop, or a Spatial-layout core icon) was present on the wallpaper.
  • relayoutRoot() in src/desktop.ts re-tiles every placement in the root folder and PATCHes each one's new position via the files REST API. Synthetic tiles only live in the JS store (settings/desktop-shortcuts-sync.ts) and are minted with a deterministic negative id, which doesn't match the REST route's \d+ id pattern — confirmed via the access log: PATCH /wp-json/desktop-mode/v1/files/placements/-1690305366 → 404.
  • The drag-and-drop path already solved this exact problem with an isSyntheticPlacement() guard in src/desktop-files/layer.ts. Exported that helper and reused it to gate the same REST call in relayoutRoot, which also covers Clean Up and the auto-arrange resize path since they share the function.

Test plan

  • npm run build
  • npm run lint
  • npm run typecheck
  • npm run test:js (2051 tests passing)
  • Manual: right-click wallpaper → Sort by → any option, with a dock item promoted to the desktop (or Spatial layout on) — no 404 in Network tab, tiles re-order correctly.

🤖 Generated with Claude Code

Open WordPress Playground Preview

relayoutRoot() PATCHed every root placement's new position to the
files REST API, including synthetic tiles (dock-item promotions,
Spatial-layout core icons) that only live in the JS store and carry
a deterministic negative id. PATCHing a negative id doesn't match
the REST route's \d+ pattern and 404s.

Reuse the isSyntheticPlacement() guard already used by the drag path
in desktop-files/layer.ts to skip the REST call for those tiles.
@AllTerrainDeveloper
AllTerrainDeveloper enabled auto-merge (squash) July 18, 2026 22:42
@AllTerrainDeveloper
AllTerrainDeveloper merged commit 272674a into trunk Jul 18, 2026
5 checks passed
@AllTerrainDeveloper
AllTerrainDeveloper deleted the fix/wallpaper-sort-by-synthetic-placement-404 branch July 18, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant