Merge pull request #123 from ONLYOFFICE/hotfix/section-loader

Hotfix/section loader
This commit is contained in:
Alexey Safronov 2020-11-11 22:19:04 +03:00 committed by GitHub
commit 7ad7cab1d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 23 deletions

View File

@ -1412,9 +1412,9 @@
picomatch "^2.2.2"
"@surma/rollup-plugin-off-main-thread@^1.1.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-1.4.1.tgz#bf1343e5a926e5a1da55e3affd761dda4ce143ef"
integrity sha512-ZPBWYQDdO4JZiTmTP3DABsHhIPA7bEJk9Znk7tZsrbPGanoGo8YxMv//WLx5Cvb+lRgS42+6yiOIYYHCKDmkpQ==
version "1.4.2"
resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-1.4.2.tgz#e6786b6af5799f82f7ab3a82e53f6182d2b91a58"
integrity sha512-yBMPqmd1yEJo/280PAMkychuaALyQ9Lkb5q1ck3mjJrFuEobIfhnQ4J3mbvBoISmR3SWMWV+cGB/I0lCQee79A==
dependencies:
ejs "^2.6.1"
magic-string "^0.25.0"
@ -2172,7 +2172,7 @@ asap@~2.0.6:
integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=
"asc-web-common@file:../../../packages/asc-web-common":
version "1.0.270"
version "1.0.271"
dependencies:
axios "^0.19.1"
history "4.10.1"

View File

@ -41,8 +41,8 @@ const i18n = createI18N({
});
const { Consumer } = utils.context;
const { isArrayEqual } = utils.array;
const { getSettings } = store.auth.selectors;
const { setIsLoaded } = store.auth.actions;
const { getSettings, getIsLoadedSection } = store.auth.selectors;
const { setIsLoadedSection } = store.auth.actions;
const { resendUserInvites } = api.people;
const { EmployeeStatus } = constants;
@ -68,19 +68,17 @@ class SectionBodyContent extends React.PureComponent {
isLoaded,
fetchPeople,
filter,
setIsLoaded,
setIsLoadedSection,
peopleList,
} = this.props;
if (!isLoaded) return;
if (peopleList.length <= 0) setIsLoaded();
setIsLoaded(false);
if (peopleList.length <= 0) setIsLoadedSection();
fetchPeople(filter)
.then(() => isLoaded && setIsLoaded(true))
.then(() => isLoaded && setIsLoadedSection(true))
.catch((error) => {
isLoaded && setIsLoaded(true);
isLoaded && setIsLoadedSection(true);
toastr.error(error);
});
}
@ -373,6 +371,7 @@ class SectionBodyContent extends React.PureComponent {
//console.log("Home SectionBodyContent render()");
const {
isLoaded,
isLoadedSection,
peopleList,
history,
settings,
@ -386,7 +385,7 @@ class SectionBodyContent extends React.PureComponent {
const { dialogsVisible, user } = this.state;
return !isLoaded || (isMobile && isLoading) ? (
return !isLoaded || (isMobile && isLoading) || !isLoadedSection ? (
<Loaders.Rows />
) : peopleList.length > 0 ? (
<>
@ -525,6 +524,7 @@ const mapStateToProps = (state) => {
const { filter, isLoading } = state.people;
return {
isLoaded,
isLoadedSection: getIsLoadedSection(state),
filter,
isLoading,
peopleList: getPeopleList(state),
@ -540,5 +540,5 @@ export default connect(mapStateToProps, {
resetFilter,
fetchPeople,
selectGroup,
setIsLoaded,
setIsLoadedSection,
})(withRouter(withTranslation()(SectionBodyContent)));

View File

@ -1412,9 +1412,9 @@
picomatch "^2.2.2"
"@surma/rollup-plugin-off-main-thread@^1.1.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-1.4.1.tgz#bf1343e5a926e5a1da55e3affd761dda4ce143ef"
integrity sha512-ZPBWYQDdO4JZiTmTP3DABsHhIPA7bEJk9Znk7tZsrbPGanoGo8YxMv//WLx5Cvb+lRgS42+6yiOIYYHCKDmkpQ==
version "1.4.2"
resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-1.4.2.tgz#e6786b6af5799f82f7ab3a82e53f6182d2b91a58"
integrity sha512-yBMPqmd1yEJo/280PAMkychuaALyQ9Lkb5q1ck3mjJrFuEobIfhnQ4J3mbvBoISmR3SWMWV+cGB/I0lCQee79A==
dependencies:
ejs "^2.6.1"
magic-string "^0.25.0"
@ -2165,7 +2165,7 @@ asap@~2.0.6:
integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=
"asc-web-common@file:../../../packages/asc-web-common":
version "1.0.270"
version "1.0.271"
dependencies:
axios "^0.19.1"
history "4.10.1"

View File

@ -1412,9 +1412,9 @@
picomatch "^2.2.2"
"@surma/rollup-plugin-off-main-thread@^1.1.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-1.4.1.tgz#bf1343e5a926e5a1da55e3affd761dda4ce143ef"
integrity sha512-ZPBWYQDdO4JZiTmTP3DABsHhIPA7bEJk9Znk7tZsrbPGanoGo8YxMv//WLx5Cvb+lRgS42+6yiOIYYHCKDmkpQ==
version "1.4.2"
resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-1.4.2.tgz#e6786b6af5799f82f7ab3a82e53f6182d2b91a58"
integrity sha512-yBMPqmd1yEJo/280PAMkychuaALyQ9Lkb5q1ck3mjJrFuEobIfhnQ4J3mbvBoISmR3SWMWV+cGB/I0lCQee79A==
dependencies:
ejs "^2.6.1"
magic-string "^0.25.0"
@ -2165,7 +2165,7 @@ asap@~2.0.6:
integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=
"asc-web-common@file:../../packages/asc-web-common":
version "1.0.270"
version "1.0.271"
dependencies:
axios "^0.19.1"
history "4.10.1"

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-common",
"version": "1.0.270",
"version": "1.0.271",
"description": "Ascensio System SIA common components and solutions library",
"license": "AGPL-3.0",
"files": [

View File

@ -5,6 +5,7 @@ export const SET_CURRENT_USER = "SET_CURRENT_USER";
export const SET_MODULES = "SET_MODULES";
export const SET_SETTINGS = "SET_SETTINGS";
export const SET_IS_LOADED = "SET_IS_LOADED";
export const SET_IS_LOADED_SECTION = "SET_IS_LOADED_SECTION";
export const LOGOUT = "LOGOUT";
export const SET_PASSWORD_SETTINGS = "SET_PASSWORD_SETTINGS";
export const SET_NEW_EMAIL = "SET_NEW_EMAIL";
@ -45,6 +46,13 @@ export function setIsLoaded(isLoaded) {
};
}
export function setIsLoadedSection(isLoadedSection) {
return {
type: SET_IS_LOADED_SECTION,
isLoadedSection,
};
}
export function setLogout() {
return {
type: LOGOUT,

View File

@ -3,6 +3,7 @@ import {
SET_MODULES,
SET_SETTINGS,
SET_IS_LOADED,
SET_IS_LOADED_SECTION,
LOGOUT,
SET_PASSWORD_SETTINGS,
SET_NEW_EMAIL,
@ -21,6 +22,7 @@ import { LANGUAGE, AUTH_KEY } from "../../constants";
const initialState = {
isAuthenticated: false,
isLoaded: false,
isLoadedSection: true,
user: {},
modules: [],
settings: {
@ -106,6 +108,10 @@ const authReducer = (state = initialState, action) => {
return Object.assign({}, state, {
isLoaded: action.isLoaded,
});
case SET_IS_LOADED_SECTION:
return Object.assign({}, state, {
isLoadedSection: action.isLoadedSection,
});
case SET_NEW_EMAIL:
return Object.assign({}, state, {
user: { ...state.user, email: action.email },

View File

@ -61,6 +61,8 @@ export const getSettingsCustomNamesGroupsCaption = (state) =>
export const getIsLoaded = (state) => state.auth.isLoaded;
export const getIsLoadedSection = (state) => state.auth.isLoadedSection;
export const getDefaultPage = createSelector(
[getSettings],
(settings) => (settings && settings.defaultPage) || ""