Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update getNavigationBadge method to allow Closures #12846

Closed
wants to merge 2 commits into from

Conversation

caendesilva
Copy link
Contributor

@caendesilva caendesilva commented May 17, 2024

Description

This allows badges to use dynamic or deferred data. Since the actual NavigationItem::badge method supports this I think it makes sense.

Visual changes

None

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

caendesilva and others added 2 commits May 17, 2024 21:16
This allows badges to use dynamic or deferred data. Since the actual NavigationItem::badge method supports this I think it makes sense.
@danharrin
Copy link
Member

I think a better solution would be to swap static::getNavigationBadge() with static::getNavigationBadge(...) so it gets run on demand as a Closure instead of called once? Then people don't need to change how the badge gets returned

Also, does this impact how many times the badge method is run per request, do we need to cache the result?

@danharrin danharrin closed this May 20, 2024
@danharrin
Copy link
Member

Closing as my proposed solution is a rewrite anyway

@caendesilva
Copy link
Contributor Author

Closing as my proposed solution is a rewrite anyway

Cool! Yeah this was more of a proof of concept to see if it's a good fit. I actually ended up going with your on demand closure route in my application when implementing a workaround yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants