Skip to content

fix: re-run update on every render call when no data provided#7

Merged
psd-coder merged 2 commits intomainfrom
fix-render-with-no-data
Apr 9, 2026
Merged

fix: re-run update on every render call when no data provided#7
psd-coder merged 2 commits intomainfrom
fix-render-with-no-data

Conversation

@psd-coder
Copy link
Copy Markdown
Owner

Overview

Fixes render (single-element variant) silently skipping the update callback on re-renders when no explicit data option is passed.

Problem Statement

render delegates to renderList with a single-item array. When called without data, the item was undefined, so renderList's identity check saw the same value on every call and skipped the update callback after the first render. Any caller relying on update to reflect external state without threading data through the option was silently broken.

Solution Approach

  • On each render call without explicit data, a fresh object literal is used as the list item, defeating the identity check and guaranteeing update runs.
  • When explicit data is provided the existing object-identity skip behaviour is preserved.
  • Added two focused unit tests covering these two code paths.
  • Expanded the test suite with a comprehensive nested render/renderList describe block covering element reuse, reordering, add/remove, template switching, and empty-data edge cases.

Breaking Changes

None.

Using a shared null reference caused renderList's identity check to skip
the update callback on subsequent renderOne calls. Pass a fresh object
each time so the update always runs.
@psd-coder psd-coder self-assigned this Apr 9, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

size-limit report 📦

Path Size
.size-check/index.mjs 2.35 KB (0%)
.size-check/render.mjs 417 B (+1.71% 🔺)
.size-check/context.mjs 402 B (0%)

@psd-coder psd-coder merged commit f1e00f5 into main Apr 9, 2026
5 checks passed
@psd-coder psd-coder deleted the fix-render-with-no-data branch April 9, 2026 20:53
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