fix: revert quick file write on refresh (#5943)
* fix: REVERT REVERT REVERT * fix: one more unused remove * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * Make sure connection is established before advancing settings theme test * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>
This commit is contained in:
@ -34,7 +34,6 @@ import { settingsActor, useSettings } from 'machines/appMachine'
|
||||
import { createRouteCommands } from 'lib/commandBarConfigs/routeCommandConfig'
|
||||
import { useToken } from 'machines/appMachine'
|
||||
import { createNamedViewsCommand } from 'lib/commandBarConfigs/namedViewsConfig'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
|
||||
type MachineContext<T extends AnyStateMachine> = {
|
||||
state: StateFrom<T>
|
||||
@ -61,20 +60,6 @@ export const FileMachineProvider = ({
|
||||
[]
|
||||
)
|
||||
|
||||
// Write code mirror content to disk when the page is trying to reroute
|
||||
// Our logic for codeManager.writeToFile has an artificial 1000ms timeout which
|
||||
// won't run quickly enough so users can make an edit, exit the page and lose their
|
||||
// progress within that 1000ms window.
|
||||
useEffect(() => {
|
||||
const preventUnload = (event: BeforeUnloadEvent) => {
|
||||
codeManager.writeToFileNoTimeout().catch(reportRejection)
|
||||
}
|
||||
window.addEventListener('beforeunload', preventUnload)
|
||||
return () => {
|
||||
window.removeEventListener('beforeunload', preventUnload)
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
// TODO: Engine feature is not deployed
|
||||
if (DEV) {
|
||||
|
Reference in New Issue
Block a user