F
Filament6mo ago
daudau

how to defer expensive api call in form Wizard step

I'm using the form wizard, example in my step 1, there are some options for user select (which already has default values) Then in step 2, I use these options to call expensive api call. But it seem the api already call in the step one, even the step 2 not render yet. Any one has solution for this situation like this, thank you so much
4 Replies
Tobias Platen
Tobias Platen6mo ago
Without seeing the code that is causing your problem, we won't be able to identify the error.
Alex Juchem
Alex Juchem5mo ago
same issue the request send before enter in the last step
No description
Tim van Heugten
Tim van Heugten5mo ago
Because all steps are loaded (but only one is shown). Maybe not use a step lifecycle hook to call the api, explained here: https://filamentphp.com/docs/3.x/forms/layout/wizard#step-lifecycle-hooks
Tim van Heugten
Tim van Heugten5mo ago
So use afterValidation on the step before and call the api there.