Fixes #39227 - Fix host delete toast disappearing before page refresh#10956
Fixes #39227 - Fix host delete toast disappearing before page refresh#10956nofaralfasi merged 1 commit intotheforeman:developfrom
Conversation
chris1984
left a comment
There was a problem hiding this comment.
Had one comment, tested and overall works great. Could you add a test for the new behavior?
| @@ -209,9 +209,16 @@ const HostsIndex = () => { | |||
| const dispatch = useDispatch(); | |||
| const { destroyVmOnHostDelete } = useForemanSettings(); | |||
| const hostsIndexUrl = useForemanHostsPageUrl(); | |||
| const refreshTableData = () => | |||
There was a problem hiding this comment.
The same setAPIOptions({ ...apiOptions, params: { search: urlSearchQuery } }) pattern appears in refreshTableData (line 213-215) and again in the Table's refreshData prop (line
534-538). Could you reuse refreshTableData for the Table prop too:
refreshData={refreshTableData
chris1984
left a comment
There was a problem hiding this comment.
Tested and looks good to me, thanks for adding the test and cleaning up the duplicated logic. Will let @jeremylenz take a second look incase I missed anything and provide a green ack if it looks good.
jeremylenz
left a comment
There was a problem hiding this comment.
Thanks @nofaralfasi @chris1984!
ACK based on Chris's testing
|
@nofaralfasi Please squash |
When deleting a host from the new hosts index page, the success toast notification would appear briefly then disappear because the page performed a full browser redirect, losing the Redux state. Instead of redirecting after delete on the hosts index page, refresh the table data in-place. This preserves the Redux state so the toast remains visible. The host details page still redirects since the host no longer exists. - Add onDeleteSuccess callback option to deleteHost and bulkDeleteHosts - HostsIndex passes a refresh callback instead of relying on redirect - Clear selection after bulk delete before refreshing - Add tests for host delete actions - Refactor HostsIndex to reuse refreshTableData for Table's refreshData prop Made-with: Cursor
When deleting a host from the new hosts index page, the success toast notification would appear briefly then disappear because the page performed a full browser redirect, losing the Redux state.
Instead of redirecting after delete on the hosts index page, refresh the table data in-place. This preserves the Redux state so the toast remains visible. The host details page still redirects since the host no longer exists.