fix: re-run update on every render call when no data provided#7
Merged
fix: re-run update on every render call when no data provided#7
Conversation
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.
size-limit report 📦
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fixes
render(single-element variant) silently skipping theupdatecallback on re-renders when no explicitdataoption is passed.Problem Statement
renderdelegates torenderListwith a single-item array. When called withoutdata, the item wasundefined, sorenderList's identity check saw the same value on every call and skipped theupdatecallback after the first render. Any caller relying onupdateto reflect external state without threading data through the option was silently broken.Solution Approach
rendercall without explicitdata, a fresh object literal is used as the list item, defeating the identity check and guaranteeingupdateruns.datais provided the existing object-identity skip behaviour is preserved.nested render/renderListdescribe block covering element reuse, reordering, add/remove, template switching, and empty-data edge cases.Breaking Changes
None.