From 38a6cc76bf7acab3db9c11c0bdcc7a21c455116e Mon Sep 17 00:00:00 2001 From: g-jaskowski Date: Wed, 6 Aug 2025 11:13:33 +0200 Subject: [PATCH] [ACS-9859] revert wrong code deletion --- .../src/lib/store/initial-state.ts | 25 ++++++++++++++++ .../src/lib/store/reducers/app.reducer.ts | 3 +- projects/aca-content/src/public-api.ts | 1 + .../aca-shared/store/src/states/app.state.ts | 30 +++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 projects/aca-content/src/lib/store/initial-state.ts diff --git a/projects/aca-content/src/lib/store/initial-state.ts b/projects/aca-content/src/lib/store/initial-state.ts new file mode 100644 index 000000000..4f1ab6bae --- /dev/null +++ b/projects/aca-content/src/lib/store/initial-state.ts @@ -0,0 +1,25 @@ +/*! + * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Alfresco Example Content Application + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * from Hyland Software. If not, see . + */ + +export { INITIAL_APP_STATE } from '@alfresco/aca-shared/store'; diff --git a/projects/aca-content/src/lib/store/reducers/app.reducer.ts b/projects/aca-content/src/lib/store/reducers/app.reducer.ts index 5c3ccefe6..7655da948 100644 --- a/projects/aca-content/src/lib/store/reducers/app.reducer.ts +++ b/projects/aca-content/src/lib/store/reducers/app.reducer.ts @@ -38,10 +38,11 @@ import { SetInfoDrawerPreviewStateAction, AppActionTypes, ShowLoaderAction, + INITIAL_APP_STATE, SetSearchItemsTotalCountAction } from '@alfresco/aca-shared/store'; -export function appReducer(state: AppState, action: Action): AppState { +export function appReducer(state: AppState = INITIAL_APP_STATE, action: Action): AppState { let newState: AppState; switch (action.type) { diff --git a/projects/aca-content/src/public-api.ts b/projects/aca-content/src/public-api.ts index c44335da5..55a4fa91d 100644 --- a/projects/aca-content/src/public-api.ts +++ b/projects/aca-content/src/public-api.ts @@ -28,6 +28,7 @@ export * from './lib/aca-content.module'; export * from './lib/aca-content.routes'; +export * from './lib/store/initial-state'; export * from './lib/services/content-url.service'; export * from './lib/services/content-management.service'; export * from './lib/components/info-drawer/comments-tab/external-node-permission-comments-tab.service'; diff --git a/projects/aca-shared/store/src/states/app.state.ts b/projects/aca-shared/store/src/states/app.state.ts index db4409e25..8263e68db 100644 --- a/projects/aca-shared/store/src/states/app.state.ts +++ b/projects/aca-shared/store/src/states/app.state.ts @@ -25,6 +25,36 @@ import { SelectionState, ProfileState, NavigationState } from '@alfresco/adf-extensions'; import { RepositoryInfo, VersionEntry } from '@alfresco/js-api'; +export const INITIAL_APP_STATE: AppState = { + user: { + isAdmin: null, + id: null, + firstName: '', + lastName: '' + }, + selection: { + nodes: [], + libraries: [], + isEmpty: true, + count: 0 + }, + navigation: { + currentFolder: null + }, + currentNodeVersion: null, + infoDrawerOpened: false, + infoDrawerPreview: false, + infoDrawerMetadataAspect: '', + fileUploadingDialog: true, + showLoader: false, + repository: { + status: { + isQuickShareEnabled: true + } + } as any, + searchItemsTotalCount: null +}; + export interface AppState { currentNodeVersion: VersionEntry; selection: SelectionState;