Repeater
I ma trying do do sth custom with repeater
I noticed that a callback is called so many times, and increments at every add items
This is a field inside a repeater.
I put a dump just to debug it
This is a count of printed dump to sequence add items:
- First add: 1 dump
- Second add: 12 dump
- Third add: 23 dump
- and so on
Why is called so many times?
10 Replies
https://filamentphp.com/docs/3.x/forms/fields/repeater
Check here how to use it correctly or please provide more of your code so I can see and try to help you.
Is a normal field inside a schema, later I post a code
I don't get what the problem is? Are you just asking? Or are you trying to accomplish anything specific?
The full code
The attached image show when I load create page and when I add the first Element.
My question is why it do a lot of cycle? It is a problem!
Too many call for each item, every item add, the item evaluation increase exponentially
this is for 3 item add.
Sth wrong happen or is it a normal behaviour?
If it is the normal behaviour, why? What is the purpose?
It happens for visible, I didn't have tried with ohers property
What's TableRepeater?
Does the same thing happen in a normal repeater?
yes, i have tried also in filament-demo just now.
It happen on visible, i didn't have tried on others property
Later I try on other property and make a mini-report
It happen only on:
- visible
- hidden
hmm. well, it's a callback inside of a loop, so i would say it's working as expected since each field could be conditionally shown or hidden based on the state of other fields, etc. If you think it is a bug, please submit an issue on GitHub.
I used in a wrong way.
I used two fields conditionally based on other field to save is_global value, because disabled don't save a value.
I mean, I need a toggle button readonly, but ->disabled() make hydratate false, so I fix setting ->diasbled()->dehydratate(true)