🎥 Make videos programmatically with React
unsaved changes
Jonny Burgerbb75427040fb
diff --git a/packages/cli/src/preview-server/error-overlay/react-overlay/listen-to-runtime-errors.ts b/packages/cli/src/preview-server/error-overlay/react-overlay/listen-to-runtime-errors.tsindex 86b65f8ddd..69e8513b66 100644--- a/packages/cli/src/preview-server/error-overlay/react-overlay/listen-to-runtime-errors.ts+++ b/packages/cli/src/preview-server/error-overlay/react-overlay/listen-to-runtime-errors.ts@@ -1,4 +1,3 @@-import {notificationCenter} from '../../../editor/components/Notifications/NotificationCenter';import {setErrorsRef} from '../remotion-overlay/Overlay';import {massageWarning} from './effects/format-warning';import {@@ -73,17 +72,9 @@ const crashWithFrames = (crash: () => void) => (error: Error) => {if (didHookOrderChange && !justRefreshedBecauseOfHooks) {// eslint-disable-next-line no-consoleconsole.log('Hook order changed. Reloading app...');- if (window.remotion_unsavedProps) {- notificationCenter.current?.addNotification({- id: new Date().toString(),- content:- 'There are unsaved changes to the props. Do you want to leave?',- created: new Date().getMilliseconds(),- duration: 1,- });- } else {- window.location.reload();- }++ window.remotion_unsavedProps = false;+ window.location.reload();} else {setErrorsRef.current?.addError(error);diff --git a/packages/cli/src/preview-server/hot-middleware/process-update.ts b/packages/cli/src/preview-server/hot-middleware/process-update.tsindex ef6e6e1e13..0b174ed854 100644--- a/packages/cli/src/preview-server/hot-middleware/process-update.ts+++ b/packages/cli/src/preview-server/hot-middleware/process-update.ts@@ -170,15 +170,7 @@ export const processUpdate = function (console.warn('[Fast refresh] Update check failed: ' + (err.stack || err.message));- if (window.remotion_unsavedProps) {- notificationCenter.current?.addNotification({- id: new Date().toString(),- content:- 'There are unsaved changes to the props. Do you want to leave?',- created: new Date().getMilliseconds(),- duration: 1,- });- } else {+ if (!window.remotion_unsavedProps) {window.location.reload();}}@@ -194,7 +186,7 @@ export const processUpdate = function (notificationCenter.current?.addNotification({id: 'random',content:- 'There are unsaved changes to the props. Do you want to leave?',+ 'Fast refresh needs to reload the page, but you have unsaved props. Save then reload the page to apply changes.',created: new Date().getMilliseconds(),duration: 1,});diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex 0a4792d568..d77944077c 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -53,7 +53,7 @@ declare global {siteVersion: '10';remotion_version: string;remotion_imported: string | boolean;- remotion_unsavedProps: boolean | null | undefined;+ remotion_unsavedProps: boolean | undefined;}}