Skip to content

Fix data-lit state setter and resize render loops - #231

Merged
krisnye merged 1 commit into
mainfrom
fix/data-lit-state-render-loops
Oct 29, 2026
Merged

krisnye merged 1 commit into
mainfrom
fix/data-lit-state-render-loops

Conversation

@kaiortmanns

Copy link
Copy Markdown
Collaborator

Description

Prevent render loops caused by unstable state setters, unchanged state updates, and resize observer callback churn.

  • Store each state value and its stable setter together in the existing hook slot.
  • Skip update requests when Object.is reports an unchanged value.
  • Initialize lazy state once per hook lifetime, including null and undefined values.
  • Keep resize observers attached across renders while invoking the latest callback.
  • Document state equality and immutable object/array updates.

Compatibility

Mutating an object or array in place and passing the same reference to its state setter no longer requests a render. Consumers must provide a new reference for changed contents. External firefly-platform consumers have not been validated in this checkout.

Test Evidence

  • All 43 data-lit tests pass, including 18 new state and resize regressions.
  • tsc -b packages/data-lit passes.
  • git diff --check passes.

Regression coverage includes stable setters, repeated equal writes, NaN and signed zero semantics, nullish initialization and updates, independent state slots, observer reuse, latest callback delivery, memo stability, unchanged-width suppression, and unmount/remount cleanup.

PR Checklist

  • Add focused regression tests.
  • Run the complete data-lit test suite and package typecheck.
  • Document the same-reference state update compatibility change.
  • Screenshots: N/A (no visual UI changes).
  • Feature flags: N/A (none added or removed).
  • CI checks: pending.

Jira Ticket

N/A (no ticket provided).

Related PRs

None.

@kaiortmanns
kaiortmanns requested a review from krisnye October 29, 2026 20:30
@krisnye
krisnye merged commit 1d26bb0 into main Oct 29, 2026
3 checks passed
@krisnye
krisnye deleted the fix/data-lit-state-render-loops branch October 29, 2026 21:06
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.

2 participants