1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00

Personal Server - remove same function on disconnect as added on reconnect. (#4006)

* only dispatch initialLoad if me is defined, prevents recalling in loop

* update to add/remove same function on reconnect
This commit is contained in:
Scott Bishel 2022-10-20 03:02:11 -06:00 committed by GitHub
parent 6ea67987e6
commit 667abb3a55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,11 +141,15 @@ const BoardPage = (props: Props): JSX.Element => {
}
}
const dispatchLoadAction = () => {
dispatch(loadAction(match.params.boardId))
}
Utils.log('useWEbsocket adding onChange handler')
wsClient.addOnChange(incrementalBlockUpdate, 'block')
wsClient.addOnChange(incrementalBoardUpdate, 'board')
wsClient.addOnChange(incrementalBoardMemberUpdate, 'boardMembers')
wsClient.addOnReconnect(() => dispatch(loadAction(match.params.boardId)))
wsClient.addOnReconnect(dispatchLoadAction)
wsClient.setOnFollowBlock((_: WSClient, subscription: Subscription): void => {
if (subscription.subscriberId === me?.id) {
@ -163,7 +167,7 @@ const BoardPage = (props: Props): JSX.Element => {
wsClient.removeOnChange(incrementalBlockUpdate, 'block')
wsClient.removeOnChange(incrementalBoardUpdate, 'board')
wsClient.removeOnChange(incrementalBoardMemberUpdate, 'boardMembers')
wsClient.removeOnReconnect(() => dispatch(loadAction(match.params.boardId)))
wsClient.removeOnReconnect(dispatchLoadAction)
}
}, [me?.id, activeBoardId])