Repository navigation
fix: cache the entity registry per filament panel [4.x] - #294
Merged
Merged
Conversation
Discovery builds the registry from the current panel's resources, but the cache key was shared, so a multi-panel app served every panel the registry of whichever panel built it first. The key now carries the panel id, and the configured ttl reaches the cache.
Clears the cached entity registry of every panel, so a deploy can drop a registry built from the previous configuration.
A long-lived manager, such as a queue worker running import jobs for several panels, kept serving the first panel's registry and could write it under another panel's cache key. The manager's memo is now keyed by panel id, and discovery no longer keeps its own memo.
ManukMinasyan
force-pushed
the
fix/cache-entity-registry-per-panel-4x
branch
from
November 9, 2026 11:25
3a1ae2d to
cb7422a
Compare
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.
This forward-ports #289 to
4.x.v4.0.0-beta.2caches the entity registry under one key,custom_fields_entities, while discovery reads the current Filament panel's resources. So an app with several panels serves every panel the registry of whichever panel built the cache first. The other panels lose a model's resource class, its title attribute (falling back toid) and its search attributes for the full TTL.What changed
Cherry-picks of the three #289 commits, which apply unchanged.
EntityManager,EntityDiscovery,EntityServiceProvider,CustomFieldsServiceProviderand the configuration docs are identical on4.xand the3.xbase they were written against.EntityManagercaches the registry per panel (custom_fields_entities:<panel id>,no-panelwithout a default panel), in memory and in the cache store.EntityDiscoverydrops its own memo, which held the first panel's resources for the life of the singleton.ttlpassed toEntityConfigurator::cache()reaches the cache instead of a hardcoded 3600.custom-fields:clear-cachecommand forgets every panel's key, for use as a deploy step.Behavior to know about
Tests
tests/Feature/EntityRegistryCacheTest.php(4 tests, unchanged from #289): per-panel registries whichever panel builds first, one manager across a panel switch, the configured TTL, and the clear command removing both panels' keys. They fail on3.xbefore #289, and the code they cover is identical here.Checked
On
cb7422ac, with the committedcomposer.lock:vendor/bin/pest --parallel: 936 passed, 3 todo.ImportContractConformanceTest,ImportDateFormatTestandConsumerScopeHooksTest. A cleanorigin/4.xreports the same 3, and this branch touches none of those files.