Add deferred badge loading for relation manager tabs#19464
Open
buzkall wants to merge 1 commit intofilamentphp:4.xfrom
Open
Add deferred badge loading for relation manager tabs#19464buzkall wants to merge 1 commit intofilamentphp:4.xfrom
buzkall wants to merge 1 commit intofilamentphp:4.xfrom
Conversation
Extends the deferred tab badge loading introduced in PR filamentphp#19336 to relation manager tabs, fixing two upstream issues: 1. `RelationManager::getTabComponent()` was evaluating `getBadge()` eagerly before the deferred mechanism could intercept it. 2. `HasRelationManagers::getRelationManagersContentComponent()` built `Tabs::make()` with no key, causing `callSchemaComponentMethod()` to receive null when the async badge fetch fired. Changes: - Add `protected static bool $deferBadge = false` to `RelationManager` with an overrideable `isBadgeDeferred()` method for per-record control - Add fluent `->deferBadge()` and `isBadgeDeferred()` to `RelationGroup` - Add `->key('relationManagerTabs')` to the `Tabs` built in `HasRelationManagers` - Add docs and tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Wouldn't it make sence to add a defer option in addition to all badges. So TextColumns, NavigationBadge, TextEntry... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Extends the deferred tab badge loading introduced in #19336 to relation manager tabs.
Problem:
RelationManager::getTabComponent()evaluatesgetBadge()synchronously, and theTabscomponent built byHasRelationManagershas no key — both of which preventdeferBadge()from working.Solution:
protected static bool $deferBadge = falsetoRelationManager(overrideable viaisBadgeDeferred()for dynamic, per-record control)->deferBadge()toRelationGroup->key('relationManagerTabs')to theTabsbuilt inHasRelationManagersConsumer usage
No need to override
getTabComponent()or the Edit page class.Checklist
composer cscommand.