From 503bb5325f540071ba67d70a5793eaa0246c7f3e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Sep 2022 11:57:30 +0200 Subject: [PATCH 1/2] chore(deps-dev): bump stream-chat from 6.9.0 to 7.1.0 (#1733) Bumps [stream-chat](https://github.com/GetStream/stream-chat-js) from 6.9.0 to 7.1.0. - [Release notes](https://github.com/GetStream/stream-chat-js/releases) - [Changelog](https://github.com/GetStream/stream-chat-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/GetStream/stream-chat-js/compare/v6.9.0...v7.1.0) --- updated-dependencies: - dependency-name: stream-chat dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 7efa9162af..efee6b700a 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "peerDependencies": { "react": "^18.0.0 || ^17.0.0 || ^16.8.0", "react-dom": "^18.0.0 || ^17.0.0 || ^16.8.0", - "stream-chat": "^6.9.0" + "stream-chat": "^7.1.0" }, "files": [ "dist", @@ -167,7 +167,7 @@ "rollup-plugin-visualizer": "^4.2.0", "semantic-release": "^19.0.2", "semantic-release-cli": "^5.4.4", - "stream-chat": "^6.9.0", + "stream-chat": "^7.1.0", "style-loader": "^2.0.0", "ts-jest": "^26.5.1", "tslib": "2.3.0", diff --git a/yarn.lock b/yarn.lock index 1922386737..2a21f73a58 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16050,10 +16050,10 @@ stream-browserify@^2.0.1: inherits "~2.0.1" readable-stream "^2.0.2" -stream-chat@^6.9.0: - version "6.9.0" - resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-6.9.0.tgz#cc5c8e68849b36a891178b6b39cd150fc8a69ddf" - integrity sha512-GERt6ohbMucs1mOFY6xoU3p9gl0oEQieod09hSiaRnHG++LP//SQafYlSyE9v2n368VQcc6OSiP5tAinBWafJw== +stream-chat@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-7.1.0.tgz#b5dc7f999d32aa257bb2458d5c57116acb4a656f" + integrity sha512-MY3dXFbF5xIGKjXE6qHAjzLQkjMeZARCWl22EP7qkVDH0fCzuhRO2MR5L3MaatX3rrUj7MkkLc0Mw0rqjY7PPw== dependencies: "@babel/runtime" "^7.16.3" "@types/jsonwebtoken" "^8.5.6" From 488a1b1981eeecedb5d26b22dff581f6cf9a5338 Mon Sep 17 00:00:00 2001 From: Petyo Ivanov Date: Thu, 8 Sep 2022 13:12:31 +0300 Subject: [PATCH 2/2] fix: avoid race condition crash in jumping --- src/components/Channel/Channel.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Channel/Channel.tsx b/src/components/Channel/Channel.tsx index 525a3756c8..23d0c4c63a 100644 --- a/src/components/Channel/Channel.tsx +++ b/src/components/Channel/Channel.tsx @@ -524,6 +524,8 @@ const ChannelInner = < return queryResponse.messages.length; }; + const clearHighlightedMessageTimeoutId = useRef | null>(null); + const jumpToMessage = async (messageId: string, messageLimit = 100) => { dispatch({ loadingMore: true, type: 'setLoadingMore' }); await channel.state.loadMessageIntoState(messageId, undefined, messageLimit); @@ -542,7 +544,12 @@ const ChannelInner = < type: 'jumpToMessageFinished', }); - setTimeout(() => { + if (clearHighlightedMessageTimeoutId.current) { + clearTimeout(clearHighlightedMessageTimeoutId.current); + } + + clearHighlightedMessageTimeoutId.current = setTimeout(() => { + clearHighlightedMessageTimeoutId.current = null; dispatch({ type: 'clearHighlightedMessage' }); }, 500); };