budibase
budibase copied to clipboard
Refresh State in Parent from Child Modal
Discussed in https://github.com/Budibase/budibase/discussions/5524
It might be nice to have an optional redirect URL for the close modal action. I've suggested that here: https://github.com/Budibase/budibase/discussions/1176#discussioncomment-2614757
Another discussion with the same issue: https://github.com/Budibase/budibase/discussions/5626
Need a way to update state from a modal screen, or as suggested a redirect option after the modal has been closed.
Need a way to update state from a modal screen
State updates are already proxied back from screens in modals - so that's usually the best solution if you need to pass back some value from the modal that isn't saved as data. i.e. if you use update state from a screen in a modal, the state is updated on the parent immediately as well.
Can keep this open as a feature request to add an option for redirecting on closing a screen modal though.
That's cool! I think then it's the on change feature that's needed so that updating the state updates the fields.
The redirect idea was really just another work around for this, but it may have some other use cases, but not a priority. Haven't seen anyone else ask for it specifically.
Actually, you can't simply use the on change, because the field you're trying to update is in a different screen. The same issue has popped up here:
https://github.com/Budibase/budibase/discussions/6181
This issue has been automatically marked as stale because it has not had recent activity.
Any progress on this issue?
I'm also interested in this. I want to close a modal and for it to trigger the 'Refresh Data Provider' action. Can't seem to figure out a way to do this at the moment natively in Budibase.
@adamjdavies if you've edited data inside the modal that is part of the same datasource as the parent page, then you shouldn't need to manually refresh the data provider - it should do it automatically. This won't work if you're using a rest API as your datasource but should work for anything else (including custom queries).
Maybe you have other reasons for needing a refresh, but if you're editing data in the same datasource then this should work automatically and would be a bug if it isn't.
@aptkingston - all of my data is being pulled from an Airtable query, so I need to update the datasource each time a change is made. Therefore, I need some way of triggering 'Refresh Data Provider' action when either the modal is closed or based off of some trigger.
The ability to trigger page actions based on a state change or other conditions is something I think Budibase is missing.