File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,16 @@ const conversationSearchOptionKey = "conversation_search_option";
99const conversationUserMessageKey = "conversation_user_messages" ;
1010
1111/** @type {Writable<import('$commonTypes').GlobalEvent> } */
12- export const globalEventStore = writable ( { name : "" , payload : { } } ) ;
12+ const createGlobalEventStore = ( ) => {
13+ const { subscribe, set } = writable ( { name : "" , payload : { } } ) ;
14+ return {
15+ subscribe,
16+ set,
17+ reset : ( ) => set ( { } )
18+ } ;
19+ }
20+
21+ export const globalEventStore = createGlobalEventStore ( ) ;
1322
1423
1524/** @type {Writable<import('$userTypes').UserModel> } */
Original file line number Diff line number Diff line change 88 import { page } from ' $app/stores' ;
99 import { browser } from ' $app/environment' ;
1010 import { _ } from ' svelte-i18n' ;
11+ import { globalEventStore } from ' $lib/helpers/store' ;
1112
1213 /** @type {import('$pluginTypes').PluginMenuDefModel[]} */
1314 export let menu;
199200 const path = $page .url .pathname ;
200201 return path? .startsWith (' /' ) ? path .substring (1 ) : path;
201202 };
203+
204+ /** @param {string} link */
205+ const goToPage = (link ) => {
206+ globalEventStore .reset ();
207+ }
202208< / script>
203209
204210< div class = " vertical-menu" >
225231 < / Link>
226232 < ul class = " sub-menu mm-collapse" >
227233 {#each subMenu .childItems as childItem}
228- < li>< Link href= {childItem .link }> {$_ (childItem .label )}< / Link>< / li>
234+ < li>< Link href= {childItem .link } on : click = {() => goToPage ( childItem . link )} > {$_ (childItem .label )}< / Link>< / li>
229235 {/ each}
230236 < / ul>
231237 < / li>
232238 {: else }
233- < li>< Link href= {subMenu .link }> {$_ (subMenu .label )}< / Link>< / li>
239+ < li>< Link href= {subMenu .link } on : click = {() => goToPage ( subMenu . link )} > {$_ (subMenu .label )}< / Link>< / li>
234240 {/ if }
235241 {/ each}
236242 < / ul>
237243 < / li>
238244 {: else }
239245 < li>
240- < Link href= {item .link } class = " waves-effect " >
246+ < Link class = " waves-effect " href= {item .link } on : click = {() => goToPage ( item . link )} >
241247 < i class = {item .icon } / > < span> {$_ (item .label )}< / span>
242248 < / Link>
243249 < / li>
You can’t perform that action at this time.
0 commit comments