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".

Forms\Components\Select::make('title')
    ->required()
    ->searchable()
    ->reactive()
    ->getSearchResultsUsing(function (string $search) {
        $tmdb = new TMDBConnector;
        $request = new SearchMovieRequest($search);

        $response = $tmdb->send($request);

        $body = $response->body();
        $decodedBody = $response->json();

        $results = collect($decodedBody['results']);

        static::$searchResults = $results;

        return $results->pluck('title', 'id');
    })
    ->afterStateUpdated(function (Closure $set, $state) {
        dd(static::$searchResults);
    })


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!
Was this page helpful?