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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,6 +5,7 @@ export const SET_CURRENT_USER = "SET_CURRENT_USER";
export const SET_MODULES = "SET_MODULES"; export const SET_MODULES = "SET_MODULES";
export const SET_SETTINGS = "SET_SETTINGS"; export const SET_SETTINGS = "SET_SETTINGS";
export const SET_IS_LOADED = "SET_IS_LOADED"; export const SET_IS_LOADED = "SET_IS_LOADED";
export const SET_IS_LOADED_SECTION = "SET_IS_LOADED_SECTION";
export const LOGOUT = "LOGOUT"; export const LOGOUT = "LOGOUT";
export const SET_PASSWORD_SETTINGS = "SET_PASSWORD_SETTINGS"; export const SET_PASSWORD_SETTINGS = "SET_PASSWORD_SETTINGS";
export const SET_NEW_EMAIL = "SET_NEW_EMAIL"; 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() { export function setLogout() {
return { return {
type: LOGOUT, type: LOGOUT,

View File

@ -3,6 +3,7 @@ import {
SET_MODULES, SET_MODULES,
SET_SETTINGS, SET_SETTINGS,
SET_IS_LOADED, SET_IS_LOADED,
SET_IS_LOADED_SECTION,
LOGOUT, LOGOUT,
SET_PASSWORD_SETTINGS, SET_PASSWORD_SETTINGS,
SET_NEW_EMAIL, SET_NEW_EMAIL,
@ -21,6 +22,7 @@ import { LANGUAGE, AUTH_KEY } from "../../constants";
const initialState = { const initialState = {
isAuthenticated: false, isAuthenticated: false,
isLoaded: false, isLoaded: false,
isLoadedSection: true,
user: {}, user: {},
modules: [], modules: [],
settings: { settings: {
@ -106,6 +108,10 @@ const authReducer = (state = initialState, action) => {
return Object.assign({}, state, { return Object.assign({}, state, {
isLoaded: action.isLoaded, isLoaded: action.isLoaded,
}); });
case SET_IS_LOADED_SECTION:
return Object.assign({}, state, {
isLoadedSection: action.isLoadedSection,
});
case SET_NEW_EMAIL: case SET_NEW_EMAIL:
return Object.assign({}, state, { return Object.assign({}, state, {
user: { ...state.user, email: action.email }, 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 getIsLoaded = (state) => state.auth.isLoaded;
export const getIsLoadedSection = (state) => state.auth.isLoadedSection;
export const getDefaultPage = createSelector( export const getDefaultPage = createSelector(
[getSettings], [getSettings],
(settings) => (settings && settings.defaultPage) || "" (settings) => (settings && settings.defaultPage) || ""