Persisting state for ionic PWA


#1

does anyone know of a good way to persist the current state when the a PWA using ionic/angular is placed in the background (primarily for ios devices as they restart when returning to the foreground all the time)


#2

Did u try ionic storage?


#3

I have not yet, I’m just starting to work out how I’m going to do it. So far that seems to be the way I’m leaning. just need to figure out the how now.

My current plan is to effectively save the current navigation stack when the app is pushed into the background, then restore it when it comes back to the fore.
Makes sense I think.

Don’t think there is any easy way to do it currently outside of getting the current stack via the current nav, then replacing them back on the same order.

I’m hopeing thatI dont have a requirement of saving any current inputted data that hasnt been saved yet, that will get annoying i think.


#4

Consider a deeplink, through rerouting. But no experience in storing stack and restoring.

Depends on the size of the stack. Hopefully not too big… That would also indicate strange UI.

As to storing inputted data, I also don’t have strong experience, but if the browser decided to restart the app, likely the inputted data is gone too…


#5

@Slavrixx

See:

And: