SelectAction state change action

What does SelectAction call when the selection change?
I'm trying to solve model versioning with it, so after the selection i'd redirect the user to the given version, how can I implement this?
SelectAction::make('versions')
    ->options(function (Offer $record) {
        return $record->previousVersions();
    })
    ->afterStateUpdated(function ($state) {
        // Tried this method, but it doesn't exist.
    }),
Solution
I ended up to a solution like this with ActionGroup:

looping through the versions, and push actions to an array:
foreach ($recordVersions as $version) {
      $versions[] = Action::make('version' . $version->id)
          ->label($version->serial)
          ->disabled(fn (Offer $record): bool => $record->id === $version->id)
          ->url(route('filament.admin.resources.offers.edit', ['record' => $version->id]));
  }


And then made an ActionGroup with that variable:
return [
    ActionGroup::make($versions)
        ->button()
        ->color('gray')
        ->label('Versions')
        ->icon('heroicon-m-chevron-down')
        ->iconPosition(IconPosition::After)
        ->hidden(count($recordVersions) <= 1),
    ...
];
Was this page helpful?