-
-
Notifications
You must be signed in to change notification settings - Fork 6
TT-7380 fix: auto-save when editing Segment Reference in Mark Verse step #353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,7 +185,6 @@ export function PassageDetailMarkVerses({ width }: MarkVersesProps) { | |
| const { | ||
| toolChanged, | ||
| toolsChanged, | ||
| isChanged, | ||
| saveRequested, | ||
| saveCompleted, | ||
| clearRequested, | ||
|
|
@@ -616,7 +615,10 @@ export function PassageDetailMarkVerses({ width }: MarkVersesProps) { | |
| if (reset) { | ||
| resetSegments(regions); | ||
| } | ||
| if (!init && !isChanged(verseToolId)) toolChanged(verseToolId); | ||
| if (!init) { | ||
| toolChanged(verseToolId); | ||
| checkBlockersAndScheduleAutosave(); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -741,6 +743,7 @@ export function PassageDetailMarkVerses({ width }: MarkVersesProps) { | |
| setData(newData); | ||
| setSegments(); | ||
| toolChanged(verseToolId); | ||
| checkBlockersAndScheduleAutosave(); | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -845,8 +848,8 @@ export function PassageDetailMarkVerses({ width }: MarkVersesProps) { | |
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [toolsChanged, scheduleAutosave]); | ||
|
|
||
| useEffect(() => { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Devin flagged that we are now further diverging from the mobile version, which still uses an effect for this. But the logic is already different enough in the mobile version that I was thinking this is fine |
||
| if (!isChanged(verseToolId) || !hasPermission || savingRef.current) return; | ||
| const checkBlockersAndScheduleAutosave = () => { | ||
| if (!hasPermission) return; | ||
| const allIssues = checkRefs(); | ||
| const blockers = checkAutosaveBlockers(); | ||
| setSaveIssues(allIssues); | ||
|
|
@@ -885,8 +888,7 @@ export function PassageDetailMarkVerses({ width }: MarkVersesProps) { | |
| setIssuesDialogOpen(false); | ||
| } | ||
| scheduleAutosave(); | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [toolsChanged, hasPermission, scheduleAutosave]); | ||
| }; | ||
|
|
||
| return Boolean(mediafileId) && passType !== PassageTypeEnum.NOTE ? ( | ||
| <Box> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* eslint-disable react-refresh/only-export-components */ | ||
| import { useState, useEffect } from 'react'; | ||
| import { useState, useEffect, Fragment } from 'react'; | ||
| import { useGlobal } from '../context/useGlobal'; | ||
| import { | ||
| Snackbar as MuiSnackbar, | ||
|
|
@@ -45,8 +45,9 @@ function SimpleSnackbar(props: ISBProps) { | |
| }; | ||
|
|
||
| useEffect(() => { | ||
| if ((message?.type === 'span') !== open) { | ||
| setOpen(!open); | ||
| const hasMessage = !!message && message.type !== Fragment; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little nervous about this change because the SnackBar is used in so many different places. But it definitely seems like a bug that previously toasts weren't appearing because their messages were wrapped in non-spans |
||
| if (hasMessage !== open) { | ||
| setOpen(hasMessage); | ||
| } | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [message]); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot claims this test had previously been passing only by accident