From f44ac76c585bbd752a0a15b3a43dc1039c1055fe Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 24 Oct 2023 13:03:01 -0700 Subject: [PATCH] fragment: remove non-contextual fragments on start Signed-off-by: Varun Patil --- src/services/utils/fragment.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/services/utils/fragment.ts b/src/services/utils/fragment.ts index c918e430..6d28fc48 100644 --- a/src/services/utils/fragment.ts +++ b/src/services/utils/fragment.ts @@ -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