CuratorPicker hydration #455
Unanswered
mybouhssina
asked this question in
Q&A
Replies: 1 comment
-
Hmm. There's certain components in Filament that don't trigger those lifecycle hooks because they are js based. I'm not sure if the translatable component is one of those, so I unfortunately don't have a real answer for you. But it has been recommended for those other components to do the same as you are doing so if it's working I'm sure it is fine. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, I'm not sure this is the right place to ask my question, but I've encountered a problem integrating this plugin with filament-spatie-translatable, I was able to resolve the problem but I'd like to discuss the solution.
CuratorPicker field uses the afterStateHydrated to format the field, i.e. replace the media id with the media object, and the view (picker.blade.php) expect the state to be already formatted, so when the afterStateHydrated is not called, the formatting is not done and picker.blade.php throws an error at line 4 ($itemsCount = count($items);) because it expects an array and it gets an integer.
When filament-spatie-translatable switch languages, it only changes data, and doesn't trigger the stateHydrated callback, so all what I did was to override the the updatedActiveLocale Trait method and call the stateHydrated myself:
Took me a while to figure it out ngl, do you think that it's filament-spatie-translatable that should make the changes or is there a better solution ?
Beta Was this translation helpful? Give feedback.
All reactions