-
Notifications
You must be signed in to change notification settings - Fork 2
Description
I don't really like the workaround I have used where a redirect response is sent which refreshes the entire page, just to refresh the list of available actions on the index view, but can't think of an alternative.
Does anyone have a better idea about how the values which have been cached when the last action was run can then be populated into the list of actions so they are updated for the next time the action is run? Can we hook into the Vue components and their events at all?
Some places to look for ideas: Index.vue:121, Index.vue:579, ActionSelector.vue:238.
See excerpt from the docs @v1.2:
Note: Because the "Select Action" dropdown is not refreshed after an action is run on the index view,
defaultLast()cannot repopulate each last value if you run the action several times while on the same index view. If you need the value to be repopulated every time on the index view, you can set the property$refreshIndex = trueon the action class, e.g.class YourAction extends Action { protected $refreshIndex = true; public function handle(ActionFields $fields, Collection $models) { // ... } }When the action is run from the index view, it will return a redirect response to refresh the whole page. It has no effect if the action is run from the detail view, because Nova already refreshes the page after each action automatically.
Note: If you set
$refreshIndex = true, and you return your own action response from the action'shandle()method, it will be ignored on the index view because it is overridden by the redirect response. It will behave as normal on the detail view.