From cda1acdbe2a3aeac9dd55d400c0bc4f1fad612c6 Mon Sep 17 00:00:00 2001 From: Liad Yosef Date: Wed, 4 Sep 2024 14:39:36 +0300 Subject: [PATCH] fix(editor): remove error messages when deleting a file (#6309) **Problem:** We currently clear errors only when a descriptor file is deleted. This can cause syntax errors to remain even after the file that they're in was deleted. **Fix:** Clear errors on every file delete **Manual Tests:** I hereby swear that: - [X] I opened a hydrogen project and it loaded - [X] I could navigate to various routes in Preview mode Fixes #6300 --- editor/src/components/editor/actions/actions.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/editor/src/components/editor/actions/actions.tsx b/editor/src/components/editor/actions/actions.tsx index d64dea717320..d2fe43d86b6f 100644 --- a/editor/src/components/editor/actions/actions.tsx +++ b/editor/src/components/editor/actions/actions.tsx @@ -4222,21 +4222,21 @@ export const UPDATE_FNS = { }, updatedEditor) } case 'TEXT_FILE': { - const nextEditor = { + let nextEditor = { ...editor, projectContents: updatedProjectContents, } if (isComponentDescriptorFile(action.filename)) { - const withUpdatedPropertyControls = { + // update property controls + nextEditor = { ...nextEditor, propertyControlsInfo: updatePropertyControlsOnDescriptorFileDelete( editor.propertyControlsInfo, action.filename, ), } - return removeErrorMessagesForFile(withUpdatedPropertyControls, action.filename) } - return nextEditor + return removeErrorMessagesForFile(nextEditor, action.filename) } case 'ASSET_FILE': case 'IMAGE_FILE': {