Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 5267a2f

Browse files
committed
fix(community-banner): do not unsubscribe when is loading
1 parent 381e072 commit 5267a2f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

containers/CommunityBanner/logic.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const DataSolver = [
9797
action: ({ community }) => {
9898
markLoading(false)
9999
const { subPath } = store.curRoute
100+
log('community: ', community)
100101
store.setViewing({
101102
community,
102103
activeThread: subPath2Thread(subPath),
@@ -147,18 +148,17 @@ const ErrSolver = [
147148
// init & uninit
148149
// ###############################
149150
export const useInit = _store => {
150-
useEffect(
151-
() => {
152-
store = _store
153-
// log('effect init')
154-
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
155-
156-
return () => {
157-
// log('effect uninit')
151+
useEffect(() => {
152+
store = _store
153+
// log('effect init')
154+
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
155+
156+
return () => {
157+
if (sub$ && !store.loading) {
158158
sr71$.stop()
159159
sub$.unsubscribe()
160160
}
161-
},
162-
[_store]
163-
)
161+
// log('effect uninit')
162+
}
163+
}, [_store])
164164
}

0 commit comments

Comments
 (0)