diff --git a/services/web/frontend/js/features/pdf-preview/hooks/use-compile-triggers.js b/services/web/frontend/js/features/pdf-preview/hooks/use-compile-triggers.js index 784dcb4007..fc88dea159 100644 --- a/services/web/frontend/js/features/pdf-preview/hooks/use-compile-triggers.js +++ b/services/web/frontend/js/features/pdf-preview/hooks/use-compile-triggers.js @@ -68,16 +68,4 @@ export default function useCompileTriggers( setOrTriggerChangedAt(Date.now()) }, [setOrTriggerChangedAt]) useEventListener('doc:changed', setChangedAtHandler) - - // record when the server acknowledges saving changes - const setOrTriggerSavedAt = useDetachAction( - 'set-saved-at', - setSavedAt, - 'detacher', - 'detached' - ) - const setSavedAtHandler = useCallback(() => { - setOrTriggerSavedAt(Date.now()) - }, [setOrTriggerSavedAt]) - useEventListener('doc:saved', setSavedAtHandler) } diff --git a/services/web/frontend/js/features/pdf-preview/util/compiler.js b/services/web/frontend/js/features/pdf-preview/util/compiler.js index 75b3f5a26b..b481625031 100644 --- a/services/web/frontend/js/features/pdf-preview/util/compiler.js +++ b/services/web/frontend/js/features/pdf-preview/util/compiler.js @@ -23,7 +23,6 @@ export default class DocumentCompiler { compilingRef, projectId, setChangedAt, - setSavedAt, setCompiling, setData, setFirstRenderDone, @@ -35,7 +34,6 @@ export default class DocumentCompiler { this.compilingRef = compilingRef this.projectId = projectId this.setChangedAt = setChangedAt - this.setSavedAt = setSavedAt this.setCompiling = setCompiling this.setData = setData this.setFirstRenderDone = setFirstRenderDone @@ -82,7 +80,7 @@ export default class DocumentCompiler { return resolve() } - this._onDocSavedCallback = docSavedParams => { + this._onDocSavedCallback = () => { // TODO: it's possible that there's more than one doc open with buffered ops, and ideally we'd wait for all docs to be flushed removeEventListener() resolve() @@ -124,7 +122,6 @@ export default class DocumentCompiler { // reset values this.setChangedAt(0) // TODO: wait for doc:saved? - this.setSavedAt(0) this.validationIssues = undefined const params = this.buildCompileParams(options) diff --git a/services/web/frontend/js/shared/context/local-compile-context.tsx b/services/web/frontend/js/shared/context/local-compile-context.tsx index ce86812ffa..79a46a838e 100644 --- a/services/web/frontend/js/shared/context/local-compile-context.tsx +++ b/services/web/frontend/js/shared/context/local-compile-context.tsx @@ -254,9 +254,6 @@ export const LocalCompileProvider: FC = ({ children }) => { // the timestamp that a doc was last changed const [changedAt, setChangedAt] = useState(0) - // the timestamp that a doc was last saved - const [savedAt, setSavedAt] = useState(0) - const { signal } = useAbortController() const cleanupCompileResult = useCallback(() => { @@ -288,7 +285,6 @@ export const LocalCompileProvider: FC = ({ children }) => { return new DocumentCompiler({ projectId, setChangedAt, - setSavedAt, setCompiling, setData, setFirstRenderDone, @@ -321,8 +317,8 @@ export const LocalCompileProvider: FC = ({ children }) => { }, [compiler, stopOnFirstError]) useEffect(() => { - setUncompiled(changedAt > 0 || savedAt > 0) - }, [setUncompiled, changedAt, savedAt]) + setUncompiled(changedAt > 0) + }, [setUncompiled, changedAt]) useEffect(() => { setEditedSinceCompileStarted(changedAt > 0) @@ -530,13 +526,13 @@ export const LocalCompileProvider: FC = ({ children }) => { // call the debounced autocompile function if the project is available for auto-compiling and it has changed useEffect(() => { if (canAutoCompile) { - if (changedAt > 0 || savedAt > 0) { + if (changedAt > 0) { compiler.debouncedAutoCompile() } } else { compiler.debouncedAutoCompile.cancel() } - }, [compiler, canAutoCompile, changedAt, savedAt]) + }, [compiler, canAutoCompile, changedAt]) // cancel debounced recompile on unmount useEffect(() => { @@ -651,7 +647,6 @@ export const LocalCompileProvider: FC = ({ children }) => { validationIssues, firstRenderDone, setChangedAt, - setSavedAt, cleanupCompileResult, syncToEntry, }), @@ -702,7 +697,6 @@ export const LocalCompileProvider: FC = ({ children }) => { validationIssues, firstRenderDone, setChangedAt, - setSavedAt, cleanupCompileResult, setShowLogs, toggleLogs,