Skip to content

Commit

Permalink
fix: emitter subscription error
Browse files Browse the repository at this point in the history
fix: emitter subscription error
  • Loading branch information
xiaohuoni authored Sep 21, 2023
2 parents f2ec5bf + 9f3651c commit 2ca0a17
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/slimy-chairs-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alita/plugins': patch
---

fix: useEffets error
10 changes: 6 additions & 4 deletions packages/plugins/templates/mobile-layout/layout.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,12 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
prevPathName = location.pathname;
}, 10);
}, [location.pathname]);
layoutEmitter?.useSubscription?.((e) => {
setPageNavBar(getPageNavBar());
setTabBarList(getTabBarList());
});
useEffect(()=>{
layoutEmitter?.useSubscription?.((e) => {
setPageNavBar(getPageNavBar());
setTabBarList(getTabBarList());
});
},[]);
let element = useOutlet();
{{#hasKeepAlive}}
element = useKeepOutlets();
Expand Down
10 changes: 6 additions & 4 deletions packages/plugins/templates/mobile-layout/layout5.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,12 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
prevPathName = location.pathname;
}, 10);
}, [location.pathname]);
layoutEmitter?.useSubscription?.((e) => {
setPageNavBar(getPageNavBar());
setTabBarList(getTabBarList());
});
useEffect(()=>{
layoutEmitter?.useSubscription?.((e) => {
setPageNavBar(getPageNavBar());
setTabBarList(getTabBarList());
});
},[]);
let element = useOutlet();
{{#hasKeepAlive}}
element = useKeepOutlets();
Expand Down

0 comments on commit 2ca0a17

Please sign in to comment.