Static property state does not persist
I don't know if this is a general PHP thing or has got to do with the way Filament works or I'm doing something wrong but somehow the state doesn't persist.
I'm setting a static property in the
getSearchResultsUsing()
function and afterwards retrieve that property in the afterStateUpdated()
function but it errors with the message "must not be accessed before initialization".
What is happening here? What can I do to save data between the functions or am I doing something completely wrong conceptually. Thanks in advance!4 Replies
It's a PHP thing. Those are two separate requests. One for getting the results and the next for updating the result
Okay and how would I be able to store this data between the requests? Wanted to avoid making 2 requests to the api for data that is already present in the first request.
You could use a Cache. Depending on how often the data changes
You could also just cache it for some seconds
okay thank you :)