Skip to content

Cache ShouldAddComponentAsync result in SimplePageToolbarContributor.#24609

Merged
EngincanV merged 1 commit intorel-10.0from
SimplePageToolbarContributor
Jan 12, 2026
Merged

Cache ShouldAddComponentAsync result in SimplePageToolbarContributor.#24609
EngincanV merged 1 commit intorel-10.0from
SimplePageToolbarContributor

Conversation

@maliming
Copy link
Member

SimplePageToolbarContributor will be recreated when the page refreshes. We can cache the permission check result.

Resolve #24608

Copilot AI review requested due to automatic review settings January 12, 2026 04:09
@maliming maliming added this to the 10.0-patch-final milestone Jan 12, 2026
@maliming maliming changed the title Cache ShouldAddComponentAsync result in toolbar contributor Cache ShouldAddComponentAsync result in SimplePageToolbarContributor. Jan 12, 2026
@maliming maliming requested a review from EngincanV January 12, 2026 04:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds caching to the SimplePageToolbarContributor class in the Blazor theming framework to optimize performance by avoiding redundant permission checks. According to the description, the contributor instance is recreated on page refresh, making instance-level caching appropriate for reducing repeated authorization service calls.

Changes:

  • Added a private nullable boolean field _shouldAddComponent to cache the authorization check result
  • Refactored ShouldAddComponentAsync to check the cache first and return early if available, otherwise perform the authorization check and cache the result

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@EngincanV EngincanV merged commit b319238 into rel-10.0 Jan 12, 2026
13 of 15 checks passed
@EngincanV EngincanV deleted the SimplePageToolbarContributor branch January 12, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants