Skip to content

feat(runtime): v5 batched componentShouldUpdate#6783

Merged
johnjenkins merged 3 commits into
v5from
v5-feat-batched-componentShouldUpdate
Jul 18, 2026
Merged

feat(runtime): v5 batched componentShouldUpdate#6783
johnjenkins merged 3 commits into
v5from
v5-feat-batched-componentShouldUpdate

Conversation

@johnjenkins

@johnjenkins johnjenkins commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What is the current behavior?

GitHub Issue Number: #6759

What is the new behavior?

Documentation

Does this introduce a breaking change?

  • Yes
  • No

componentShouldUpdate now fires once per render cycle instead of once per changed @Prop/@State. The callback signature changed from (newVal, oldVal, propName) to a single changes argument: a map of every prop/state name that changed since the last render to its { newVal, oldVal }.

@Prop() prop1;

componentShouldUpdate(changes) {
  if (changes['prop1'].newVal === changes['prop1'].oldVal) {
    return false;
  }
}

Alternatively, you can get some typing via ComponentShouldUpdateChanges

@Prop() prop1;

componentShouldUpdate(changes: ComponentShouldUpdateChanges<this>) {
  if (changes['unknown'].newVal === changes['unknown'].oldVal) { // << will throw
    return false;
  }
}

Migration pathway

Users should update their componentShouldUpdate method to accept the single changes argument (optionally typed as ComponentShouldUpdateChanges<this> for per-prop typing) and 2) rewrite any per-prop branching logic to key off changes[propName] instead of the old propName parameter.

Additionally, a compiler warning will throw when more than one argument is passed to componentShouldUpdate

Testing

Other information

@johnjenkins
johnjenkins requested a review from a team as a code owner July 18, 2026 17:02
@johnjenkins johnjenkins changed the title feat(runtime): v5 batched componentShouldUpdate feat(runtime): v5 batched componentShouldUpdate Jul 18, 2026
@johnjenkins
johnjenkins merged commit 572737c into v5 Jul 18, 2026
29 checks passed
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