Skip to content

Commit

Permalink
fragment: remove non-contextual fragments on start
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <radialapps@gmail.com>
  • Loading branch information
pulsejet committed Oct 24, 2023
1 parent cf3b782 commit f44ac76
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/services/utils/fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ export const fragment = {
};

document.addEventListener('DOMContentLoaded', () => {
// Only contextual fragments should be present on page load
if (fragment.list.length) {
const contextual = fragment.list.filter((frag) => frag.type === FragmentType.viewer);
_m.router.replace({
path: _m.route.path,
query: _m.route.query,
hash: encodeFragment(contextual),
});
}

/**
* Trigger when route changes; notify listeners of popped fragments.
* @param to Switching to this route
Expand Down

0 comments on commit f44ac76

Please sign in to comment.