Skip to content

Commit

Permalink
fix: fetch page model on back nav
Browse files Browse the repository at this point in the history
On back navigation, empty page is rendered if model is unavailable. To resolve this, model of the
page is fetched and page is rendered.

Fixes #28
  • Loading branch information
sharanyavinod committed Oct 7, 2020
1 parent 8f833ca commit fb1bcd5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ModelRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,11 @@ if (isModelRouterEnabled()) {

return replaceState.apply(history, [ state, title, url ]);
};

window.onpopstate = (history: any) => {
const currentPath = history?.target?.location?.pathname;

routeModel(currentPath || null);
};

}

0 comments on commit fb1bcd5

Please sign in to comment.