Skip to content

Conversation

@nnaydenow
Copy link
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
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
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.

[UI5Element]: unnecessary invalidation for unchanged slots

4 participants