Skip to content

Fix remounting scenario#883

Merged
JoviDeCroock merged 2 commits intomainfrom
fix-repeated-prop-updates
Feb 16, 2026
Merged

Fix remounting scenario#883
JoviDeCroock merged 2 commits intomainfrom
fix-repeated-prop-updates

Conversation

@JoviDeCroock
Copy link
Member

Fixes #882 (comment)

Problem

When a component with signal-bound props (e.g. <div class={cls}>) was unmounted and later remounted via <Show>, the signal props stopped updating. The DOM element was stuck with the last value from before unmounting.

Root Cause

In createPropUpdater, the effect used props[prop] = value to deduplicate DOM writes. This wrote a plain string back into vnode.props, clobbering the original Signal reference. On remount, the DIFF hook no longer detected a Signal in the props and skipped setting up reactive tracking.

Fix

Replaced the props[prop]-based deduplication with a local lastRenderedValue variable. This avoids mutating vnode.props, preserving the Signal reference across unmount/remount cycles.

@changeset-bot
Copy link

changeset-bot bot commented Feb 16, 2026

🦋 Changeset detected

Latest commit: f46098d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@preact/signals Patch
preact-signals-devtools Patch

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

@netlify
Copy link

netlify bot commented Feb 16, 2026

Deploy Preview for preact-signals-demo ready!

Name Link
🔨 Latest commit f46098d
🔍 Latest deploy log https://app.netlify.com/projects/preact-signals-demo/deploys/6992face2240640008d57222
😎 Deploy Preview https://deploy-preview-883--preact-signals-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

Size Change: -688 B (-0.41%)

Total Size: 166 kB

Filename Size Change
docs/dist/assets/devtools-********.js 916 B +1 B (+0.11%)
docs/dist/assets/EmbeddedDevtools-********.js 16.3 kB +25 B (+0.15%)
docs/dist/assets/index-********.js 8.34 kB +7.5 kB (+894.04%) 🆘
docs/dist/assets/index-DmS-IHy1.js 0 B -8.34 kB (removed) 🏆
docs/dist/assets/signals.module-********.js 2.63 kB +25 B (+0.96%)
docs/dist/assets/Unmount-********.js 0 B -653 B (removed) 🏆
docs/dist/assets/Unmount-D_duwEP-.js 652 B +652 B (new file) 🆕
docs/dist/basic-********.js 247 B -2 B (-0.8%)
packages/devtools-ui/dist/devtools-ui.js 14.8 kB +28 B (+0.19%)
packages/devtools-ui/dist/devtools-ui.mjs 14.4 kB +26 B (+0.18%)
packages/preact/dist/signals.js 1.79 kB +27 B (+1.53%)
packages/preact/dist/signals.mjs 1.74 kB +21 B (+1.22%)
ℹ️ View Unchanged
Filename Size
docs/dist/assets/bench-********.js 1.6 kB
docs/dist/assets/client-BJrXu7B-.js 46.5 kB
docs/dist/assets/jsxRuntime.module-********.js 300 B
docs/dist/assets/preact.module-BXh5-_sV.js 4.74 kB
docs/dist/assets/signals-core.module-********.js 1.75 kB
docs/dist/assets/style-********.css 5.14 kB
docs/dist/assets/utils.module-********.js 436 B
docs/dist/nesting-********.js 1.14 kB
docs/dist/react-********.js 239 B
packages/core/dist/signals-core.js 1.79 kB
packages/core/dist/signals-core.mjs 1.78 kB
packages/debug/dist/debug.js 4.58 kB
packages/debug/dist/debug.mjs 4.09 kB
packages/devtools-adapter/dist/devtools-adapter.js 2.17 kB
packages/devtools-adapter/dist/devtools-adapter.mjs 1.88 kB
packages/preact-transform/dist/signals-*********.js 1.3 kB
packages/preact-transform/dist/signals-transform.mjs 1.29 kB
packages/preact-transform/dist/signals-transform.umd.js 1.42 kB
packages/react-transform/dist/signals-*********.js 7.28 kB
packages/react-transform/dist/signals-transform.mjs 6.47 kB
packages/react-transform/dist/signals-transform.umd.js 7.39 kB
packages/react/dist/signals.js 214 B
packages/react/dist/signals.mjs 165 B

compressed-size-action

@JoviDeCroock JoviDeCroock merged commit 849413f into main Feb 16, 2026
6 checks passed
@JoviDeCroock JoviDeCroock deleted the fix-repeated-prop-updates branch February 16, 2026 11:30
@github-actions github-actions bot mentioned this pull request Feb 16, 2026
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.

Signal doesn't update for style/class attributes in a Show component

2 participants