Skip to content

Commit c817f63

Browse files
committed
set observable value
1 parent e2ad0f7 commit c817f63

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { UmbUserDetailModel, UmbUserStateEnum } from '../types.js';
1+
import type { UmbUserDetailModel, UmbUserStartNodesModel, UmbUserStateEnum } from '../types.js';
22
import { UMB_USER_ENTITY_TYPE } from '../entity.js';
33
import { UmbUserDetailRepository } from '../repository/index.js';
44
import { UmbUserAvatarRepository } from '../repository/avatar/index.js';
@@ -31,6 +31,9 @@ export class UmbUserWorkspaceContext
3131
readonly mediaStartNodeUniques = this.#currentData.asObservablePart((data) => data?.mediaStartNodeUniques || []);
3232
readonly hasMediaRootAccess = this.#currentData.asObservablePart((data) => data?.hasMediaRootAccess || false);
3333

34+
#calculatedStartNodes = new UmbObjectState<UmbUserStartNodesModel | undefined>(undefined);
35+
readonly calculatedStartNodes = this.#calculatedStartNodes.asObservable();
36+
3437
readonly routes = new UmbWorkspaceRouteManager(this);
3538

3639
constructor(host: UmbControllerHost) {
@@ -50,6 +53,7 @@ export class UmbUserWorkspaceContext
5053

5154
async load(unique: string) {
5255
const { data, asObservable } = await this.detailRepository.requestByUnique(unique);
56+
5357
if (data) {
5458
this.setIsNew(false);
5559
this.#persistedData.update(data);
@@ -58,11 +62,9 @@ export class UmbUserWorkspaceContext
5862

5963
this.observe(asObservable(), (user) => this.onUserStoreChanges(user), 'umbUserStoreObserver');
6064

65+
// Get the calculated start nodes
6166
const { data: calculatedStartNodes } = await this.detailRepository.requestCalculateStartNodes(unique);
62-
63-
if (calculatedStartNodes) {
64-
console.log('calculatedStartNodes', calculatedStartNodes);
65-
}
67+
this.#calculatedStartNodes.setValue(calculatedStartNodes);
6668
}
6769

6870
/* TODO: some properties are allowed to update without saving.

0 commit comments

Comments
 (0)