Skip to content

Commit

Permalink
fix(editor): remove error messages when deleting a file (#6309)
Browse files Browse the repository at this point in the history
**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
  • Loading branch information
liady committed Dec 13, 2024
1 parent 650b706 commit cda1acd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions editor/src/components/editor/actions/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down

0 comments on commit cda1acd

Please sign in to comment.