|
@@ -254,9 +254,6 @@ export const LocalCompileProvider: FC = ({ children }) => {
|
|
|
// the timestamp that a doc was last changed
|
|
// the timestamp that a doc was last changed
|
|
|
const [changedAt, setChangedAt] = useState(0)
|
|
const [changedAt, setChangedAt] = useState(0)
|
|
|
|
|
|
|
|
- // the timestamp that a doc was last saved
|
|
|
|
|
- const [savedAt, setSavedAt] = useState(0)
|
|
|
|
|
-
|
|
|
|
|
const { signal } = useAbortController()
|
|
const { signal } = useAbortController()
|
|
|
|
|
|
|
|
const cleanupCompileResult = useCallback(() => {
|
|
const cleanupCompileResult = useCallback(() => {
|
|
@@ -288,7 +285,6 @@ export const LocalCompileProvider: FC = ({ children }) => {
|
|
|
return new DocumentCompiler({
|
|
return new DocumentCompiler({
|
|
|
projectId,
|
|
projectId,
|
|
|
setChangedAt,
|
|
setChangedAt,
|
|
|
- setSavedAt,
|
|
|
|
|
setCompiling,
|
|
setCompiling,
|
|
|
setData,
|
|
setData,
|
|
|
setFirstRenderDone,
|
|
setFirstRenderDone,
|
|
@@ -321,8 +317,8 @@ export const LocalCompileProvider: FC = ({ children }) => {
|
|
|
}, [compiler, stopOnFirstError])
|
|
}, [compiler, stopOnFirstError])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- setUncompiled(changedAt > 0 || savedAt > 0)
|
|
|
|
|
- }, [setUncompiled, changedAt, savedAt])
|
|
|
|
|
|
|
+ setUncompiled(changedAt > 0)
|
|
|
|
|
+ }, [setUncompiled, changedAt])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
setEditedSinceCompileStarted(changedAt > 0)
|
|
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
|
|
// call the debounced autocompile function if the project is available for auto-compiling and it has changed
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (canAutoCompile) {
|
|
if (canAutoCompile) {
|
|
|
- if (changedAt > 0 || savedAt > 0) {
|
|
|
|
|
|
|
+ if (changedAt > 0) {
|
|
|
compiler.debouncedAutoCompile()
|
|
compiler.debouncedAutoCompile()
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
compiler.debouncedAutoCompile.cancel()
|
|
compiler.debouncedAutoCompile.cancel()
|
|
|
}
|
|
}
|
|
|
- }, [compiler, canAutoCompile, changedAt, savedAt])
|
|
|
|
|
|
|
+ }, [compiler, canAutoCompile, changedAt])
|
|
|
|
|
|
|
|
// cancel debounced recompile on unmount
|
|
// cancel debounced recompile on unmount
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -651,7 +647,6 @@ export const LocalCompileProvider: FC = ({ children }) => {
|
|
|
validationIssues,
|
|
validationIssues,
|
|
|
firstRenderDone,
|
|
firstRenderDone,
|
|
|
setChangedAt,
|
|
setChangedAt,
|
|
|
- setSavedAt,
|
|
|
|
|
cleanupCompileResult,
|
|
cleanupCompileResult,
|
|
|
syncToEntry,
|
|
syncToEntry,
|
|
|
}),
|
|
}),
|
|
@@ -702,7 +697,6 @@ export const LocalCompileProvider: FC = ({ children }) => {
|
|
|
validationIssues,
|
|
validationIssues,
|
|
|
firstRenderDone,
|
|
firstRenderDone,
|
|
|
setChangedAt,
|
|
setChangedAt,
|
|
|
- setSavedAt,
|
|
|
|
|
cleanupCompileResult,
|
|
cleanupCompileResult,
|
|
|
setShowLogs,
|
|
setShowLogs,
|
|
|
toggleLogs,
|
|
toggleLogs,
|