How to clear leftover IonPage from DOM?

Facing an issue where “NewEntryCategory” page is receiving the state(reducer) of the previous NewEntryCategory page as it still remains in the DOM. Is there any way to force removal of the IonPage from the DOM?

Long navigation story:

  1. Visit EntryList page, that lists entries
  2. Navigate to NewEntryCategory page using history.push
  3. NewEntryCategory contains buttons that navigate to NewEntryName page using history.push
  4. Within NewEntryName page it is possible to get back to EntryList page with a button that uses history.replace
  5. Navigate to NewEntryCategory page using history.push, yet it uses the old state as it remains in the DOM

In essence, I want to clear/delete the old DOMs that are nolonger part of useHistory.

EntryList --[push]–> NewEntryCategory --[push]–> NewEntryName --[replace]–> EntryList

NewEntryName IonPage gets removed from the DOM due to history.replace, yet NewEntryCategory IonPage remains.

Eh nevermind, while IonPage state is part of the issue, I fixed the old context state problem by adding the second argument to the lifecycle function:

I forgot that I had checked the thread before… but the docs remain unchanged.