Skip to content

Fix fridge words after creation and remount - #441

Merged
spencerc99 merged 2 commits into
mainfrom
cx/fix-fridge-word-drag
Aug 28, 2026
Merged

Fix fridge words after creation and remount#441
spencerc99 merged 2 commits into
mainfrom
cx/fix-fridge-word-drag

Conversation

@spencerc99

Copy link
Copy Markdown
Owner

Summary

  • Register newly mounted React elements before the browser can receive input.
  • Give the fridge's built-in words stable IDs that preserve their existing shared position keys across remounts.
  • Add regressions for immediate dragging and historical built-in word identities.

Why

New custom words could appear before their drag handlers were registered, leaving them immovable until refresh. Long-lived tabs could also remount the built-in word set after the selector ID counter advanced. Those words then loaded positions belonging to different IDs and collapsed together. Fresh private tabs reset the counter, which is why the second failure appeared profile-specific.

Reproduction

  1. Create a custom word and drag it before refreshing.
  2. In a long-lived fridge tab, unmount and remount the built-in words.
  3. Before this fix, the custom word could ignore input and the remounted built-ins could bind to different saved coordinates.

Verification

  • React package tests: 56 passed.
  • Website Bun tests: 31 passed.
  • Website Vitest tests: 6 passed.
  • React and website type-checks passed.
  • Production website build passed.
  • Automated Chromium create-and-drag flow moved a new word without refresh.
  • Automated Chromium hide-and-show cycle preserved the first built-in word's historical ID and transform with no page or console errors.

PR Evidence contains screenshots from both production-built browser flows.

Release notes

Adds a patch changeset for @playhtml/react. No docs or starter-template updates are needed because the public API and usage remain unchanged.

@pkg-pr-new

pkg-pr-new Bot commented Aug 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

bun add https://pkg.pr.new/@playhtml/common@441
bun add https://pkg.pr.new/playhtml@441
bun add https://pkg.pr.new/@playhtml/react@441

commit: 2c74d7e

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying playhtml with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2c74d7e
Status: ✅  Deploy successful!
Preview URL: https://d22dbce3.playhtml.pages.dev
Branch Preview URL: https://cx-fix-fridge-word-drag.playhtml.pages.dev

View logs

@spencerc99

spencerc99 commented Aug 28, 2026

Copy link
Copy Markdown
Owner Author

Preview evidence

Deployed fridge preview: new words move immediately and built-in positions survive remounts.

Open preview · Review all evidence · Commit 2c74d7e

New word moved immediately on preview

New word moved immediately on preview

A newly created word moved 120px right and 60px down without a refresh on the deployed PR preview.

Open captured page · 1440×1000

Built-in positions survive remount on preview

Built-in positions survive remount on preview

The built-in set retained its historical ID and transform after an automated hide-and-show cycle on the deployed PR preview.

Open captured page · 1440×1000

Published by PR Evidence. Media is temporary and is removed after retention expires.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying we-were-online-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2c74d7e
Status: ✅  Deploy successful!
Preview URL: https://bf94fc99.we-were-online-website.pages.dev
Branch Preview URL: https://cx-fix-fridge-word-drag.we-were-online-website.pages.dev

View logs

@spencerc99
spencerc99 merged commit bddcd97 into main Aug 28, 2026
7 checks passed
@spencerc99
spencerc99 deleted the cx/fix-fridge-word-drag branch August 28, 2026 07:47
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