Skip to content

fix(framework): prevent redundant invalidations#12994

Merged
nnaydenow merged 3 commits intomainfrom
inv-ui5
Jan 30, 2026
Merged

fix(framework): prevent redundant invalidations#12994
nnaydenow merged 3 commits intomainfrom
inv-ui5

Conversation

@nnaydenow
Copy link
Copy Markdown
Contributor

@nnaydenow nnaydenow commented Jan 30, 2026

The onInvalidate hook was triggered for slots without real changes due to a race condition in _updateSlots.

This happened on Light DOM changes. The previous logic cached the current state, cleared the current state, processed the DOM, awaited upgrades, and then saved the new state. During this process, the state was temporarily empty, causing comparisons with the cached state to incorrectly detect changes.

Slot state does not depend on child upgrades, so the flow was updated to save the new state before awaiting upgrades. The comparison only needs to confirm that element references remain the same.

With this PR, state updates are extracted and made synchronous. This keeps the state in sync with the Light DOM even if another slot update is triggered, and ensures comparisons return correct results.

As a result, onInvalidate is fired only when an actual slot change occurs and with accurate state data.

Fixes: #10377

@ui5-webcomponents-bot
Copy link
Copy Markdown
Collaborator

ui5-webcomponents-bot commented Jan 30, 2026

🧹 Preview deployment cleaned up: https://pr-12994--ui5-webcomponents.netlify.app

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 30, 2026 12:00 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 30, 2026 12:13 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 30, 2026 12:31 Inactive
@nnaydenow nnaydenow changed the title fix(ui5element): prevent redundant invalidations fix(framework): prevent redundant invalidations Jan 30, 2026
@nnaydenow nnaydenow requested a review from vladitasev January 30, 2026 13:26
@nnaydenow nnaydenow merged commit b6c582c into main Jan 30, 2026
27 of 30 checks passed
@nnaydenow nnaydenow deleted the inv-ui5 branch January 30, 2026 14:17
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 30, 2026 14:17 Inactive
@ui5-webcomponents-bot
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version v2.19.0-rc.3 🎉

The release is available on v2.19.0-rc.3

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI5Element]: unnecessary invalidation for unchanged slots

3 participants