How to refresh form fields after action?

I have a very simple action, that looks like this protected function getActions(): array { return [ Action::make('Cambiar a Creada') ->action(function () { self::$quoteService->changeStateToCreated($this->record->id); $this->refreshFormData([ 'stateId', ]); }) ->requiresConfirmation() ->modalHeading('Finalizar de llenar y crear cotizacion?') ->modalSubheading("Ya no podra revertir los cambios") ->modalButton('Si!') ]; } My focus is on the 'stateId' which you can't see here, but it's a Select field on the resource. This is the code of the select Select::make('stateId') ->label('Estado') ->options(QuoteState::all()->pluck('name', 'id')) ->relationship('state', 'name') ->disabled() ->hiddenOn('create'), When I open the view page, that Select looks fine (like the first picture you see on this post). But when I trigger the action, everything works fine, but the Select now looks like reseted. It looks like it was "deselected" (as you will see in the second picture). Why is that? Why
6 Replies
barrerakj
barrerakjOP2y ago
Dan Harrin
Dan Harrin2y ago
Very weird, it does sound like a bug to be honest does it happen on other fields that arent selects
barrerakj
barrerakjOP2y ago
As far as I can tell, no, it doesn't happen. Also, since I'm doing this in the View page, if I take any other action, like edit the resource or attach things in the relation manager, the field updates properly.
Dan Harrin
Dan Harrin2y ago
sounds like a bug, please report with a minimal reproduction repository
barrerakj
barrerakjOP2y ago
Ok, I was wrong. It does happen in other fields that are not selects. How do I reporte a bug? In Github?
Dan Harrin
Dan Harrin2y ago
yes
Want results from more Discord servers?
Add your server