Skip to content

Commit

Permalink
fix(editor): CreationType update fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mammerla committed Aug 31, 2024
1 parent 23e03d0 commit 2a6c07e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/src/UX/ProjectItemEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ export default class ProjectItemEditor extends Component<IProjectItemEditorProps

const ep = this.props.activeProjectItem.effectiveEditPreference;

if (this.props.activeProjectItem.creationType !== ProjectItemCreationType.normal) {
if (
this.props.activeProjectItem.creationType !== ProjectItemCreationType.normal &&
this.props.activeProjectItem.creationType !== undefined
) {
readOnly = true;
}

Expand Down
4 changes: 3 additions & 1 deletion app/src/UX/ProjectItemList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,9 @@ export default class ProjectItemList extends Component<IProjectItemListProps, IP
}

return (
(projectItem.creationType === ProjectItemCreationType.normal || this.props.project.showHiddenItems) &&
(projectItem.creationType === undefined ||
projectItem.creationType === ProjectItemCreationType.normal ||
this.props.project.showHiddenItems) &&
perTypeShouldShow &&
(projectItem.itemType !== ProjectItemType.json || !fileName.startsWith(".")) && // hide files like .prettierrc.json from view
(projectItem.itemType !== ProjectItemType.json || !fileName.startsWith("extensions")) && // hide files like extensions.json from view
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ export default class Project {
for (let i = 0; i < this.#items.length; i++) {
const item = this.#items[i];

if (item.creationType) {
if (item.creationType === ProjectItemCreationType.generated) {
await item.updateAutogenerated();
}

Expand Down
6 changes: 5 additions & 1 deletion app/src/app/ProjectItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,11 @@ export default class ProjectItem {
}

get needsSave() {
if (this._file === null && this.creationType && this.storageType === ProjectItemStorageType.singleFile) {
if (
this._file === null &&
this.creationType === ProjectItemCreationType.generated &&
this.storageType === ProjectItemStorageType.singleFile
) {
return true;
}

Expand Down

0 comments on commit 2a6c07e

Please sign in to comment.