Skip to content

Commit d6ae173

Browse files
committed
resetState methods for block
1 parent 4ade381 commit d6ae173

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/packages/block/block-type/workspace/block-type-workspace.context.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ export class UmbBlockTypeWorkspaceContext<BlockTypeData extends UmbBlockTypeWith
3030
readonly name = this.#data.asObservablePart(() => 'block');
3131
readonly unique = this.#data.asObservablePart((data) => data?.contentElementTypeKey);
3232

33-
#properties = new UmbArrayState<PropertyEditorSettingsProperty>([], (x) => x.alias);
34-
readonly properties = this.#properties.asObservable();
35-
3633
constructor(host: UmbControllerHost, args: { manifest: ManifestWorkspace }) {
3734
super(host, args.manifest.alias);
3835
const manifest = args.manifest;
@@ -73,7 +70,7 @@ export class UmbBlockTypeWorkspaceContext<BlockTypeData extends UmbBlockTypeWith
7370
protected override resetState() {
7471
super.resetState();
7572
this.#data.setValue(undefined);
76-
this.#properties.setValue([]);
73+
this.removeUmbControllerByAlias('isNewRedirectController');
7774
}
7875

7976
createPropertyDatasetContext(host: UmbControllerHost): UmbPropertyDatasetContext {
@@ -168,7 +165,6 @@ export class UmbBlockTypeWorkspaceContext<BlockTypeData extends UmbBlockTypeWith
168165

169166
public override destroy(): void {
170167
this.#data.destroy();
171-
this.#properties.destroy();
172168
super.destroy();
173169
}
174170
}

src/packages/block/block/workspace/block-workspace.context.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,24 @@ export class UmbBlockWorkspaceContext<LayoutDataType extends UmbBlockLayoutBaseM
112112
]);
113113
}
114114

115+
protected override resetState() {
116+
super.resetState();
117+
this.#label.setValue(undefined);
118+
this.#layout.setValue(undefined);
119+
this.#initialLayout = undefined;
120+
this.#initialContent = undefined;
121+
this.#initialSettings = undefined;
122+
this.content.reset();
123+
this.settings.reset();
124+
this.removeUmbControllerByAlias('isNewRedirectController');
125+
}
126+
115127
async load(unique: string) {
116128
await this.#retrieveBlockManager;
117129
await this.#retrieveBlockEntries;
118130
await this.#editorConfigPromise;
119131
if (!this.#blockManager || !this.#blockEntries) {
120132
throw new Error('Block manager not found');
121-
return;
122133
}
123134

124135
this.observe(

0 commit comments

Comments
 (0)