What is a SharedState?

We were developing an app with router settings like lazyDestroy, lazyCreate. Now we are modifying it to work on default settings. So we removed the router settings and trying to fix the issues which are coming up.
We are facing one error which is coming all over the app. Let’s say we have a pageA which can be opened from different pages of the app. The first time (lets say from pageB) it is working fine but after that if we open it again from different flow - say pageC, sometimes it is throwing this particular error related to states and its sharedPath.

I was looking for information about Component States - Change Events, and I found about event parameter. The event parameter contains information to help identifying the state changes, for example:

    newState: '',
    prevState: '',
    sharedState: ''

Can anyone help me out about what this sharedState is and what are different scenarios it can be used for ?


LazyCreate / LazyDestroy will dynamically create and remove pages after being used. It seems like something is trying to be changed on a page that was removed or hasn’t been created yet.

The shared state looks like it grabs the states of the parents so a child could change its state based on what the state value is on a parent component.

static _getSharedState(state1, state2) {
        const state1Array = StateMachine._getAncestorStates(state1);
        const state2Array = StateMachine._getAncestorStates(state2);
        const n = Math.min(state1Array.length, state2Array.length);
        for (let i = 0; i < n; i++) {
            if (state1Array[i] !== state2Array[i]) {
                return state1Array[i - 1];
        return state1Array[n - 1];

Hope that helps