Grab new story duration whenever messageId changes
This commit is contained in:
parent
726e67ce95
commit
808118d1e4
1 changed files with 4 additions and 1 deletions
|
@ -196,6 +196,9 @@ export const StoryViewer = ({
|
||||||
setHasExpandedCaption(false);
|
setHasExpandedCaption(false);
|
||||||
}, [messageId]);
|
}, [messageId]);
|
||||||
|
|
||||||
|
// messageId is set as a dependency so that we can reset the story duration
|
||||||
|
// when a new story is selected in case the same story (and same attachment)
|
||||||
|
// are sequentially posted.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let shouldCancel = false;
|
let shouldCancel = false;
|
||||||
(async function hydrateStoryDuration() {
|
(async function hydrateStoryDuration() {
|
||||||
|
@ -218,7 +221,7 @@ export const StoryViewer = ({
|
||||||
return () => {
|
return () => {
|
||||||
shouldCancel = true;
|
shouldCancel = true;
|
||||||
};
|
};
|
||||||
}, [attachment]);
|
}, [attachment, messageId]);
|
||||||
|
|
||||||
const unmountRef = useRef<boolean>(false);
|
const unmountRef = useRef<boolean>(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue