Skip to content

Commit

Permalink
fix: emitter subscription error
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohuoni committed Sep 21, 2023
1 parent f2ec5bf commit 9f3651c
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 9f3651c

Please sign in to comment.