Toggle reverting to previous value on save

I have a toggle:
Toggle::make('is_active')->disabledOn('create')->default(true)->label('Active'),
Toggle::make('is_active')->disabledOn('create')->default(true)->label('Active'),
When I change it and click save on the resource, it says it saves succesfully, but then reverts back to it's original value. After refreshing the page it's value is updated. How do I ensure that changing the value and clicking save doesn't lose the updated value?
10 Replies
Jon Mason
Jon MasonOP10mo ago
I've tried both live() and reactive() to see if that would have any effect, but it didn't work.
LeandroFerreira
LeandroFerreira10mo ago
Are you using the panel builder? Any console error?
Jon Mason
Jon MasonOP10mo ago
This is on a Resource class. There are no errors in the console. seeing the same thing with a Select on the same page.
LeandroFerreira
LeandroFerreira10mo ago
Hum.. did you try it in another resource?
Jon Mason
Jon MasonOP10mo ago
no, not yet.
LeandroFerreira
LeandroFerreira10mo ago
Are you trying it on the Edit page, right?
Jon Mason
Jon MasonOP10mo ago
yep
LeandroFerreira
LeandroFerreira10mo ago
default isn't applied because it is disabled on the create page
Jon Mason
Jon MasonOP10mo ago
I took off both the disabledOn and default modifiers and it is behaving the same way. I'm just going to get rid of the toggle. I already have a delete button, so it's kind of duplicative anyway.
LeandroFerreira
LeandroFerreira10mo ago
I don't know why it is reverting to the previous value... you could try it in another resource..
Want results from more Discord servers?
Add your server