Skip to content

Commit

Permalink
Web:Studio:Fix reminderTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
gazizova-vlada committed Apr 21, 2022
1 parent b4c6e55 commit 596153a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const PortalRenaming = (props) => {
portalNameFromSessionStorage || tenantAlias
);
const [portalNameDefault, setPortalNameDefault] = useState(
portalNameDefaultFromSessionStorage || portalName
portalNameDefaultFromSessionStorage || tenantAlias
);

const [showReminder, setShowReminder] = useState(false);
Expand All @@ -63,8 +63,7 @@ const PortalRenaming = (props) => {

const checkScroll = checkScrollSettingsBlock();

window.addEventListener("resize", checkInnerWidth);
window.addEventListener("resize", checkScroll);
window.addEventListener("resize", checkInnerWidth, checkScroll);

const scrollPortalName = checkScroll();

Expand All @@ -91,7 +90,10 @@ const PortalRenaming = (props) => {

useEffect(() => {
if (isLoadedSetting) setIsLoadedPortalRenaming(isLoadedSetting);
}, [isLoadedSetting]);
if (portalNameDefault) {
checkChanges();
}
}, [isLoadedSetting, portalNameDefault]);

const onSavePortalRename = () => {
setIsLoadingPortalNameSave(true);
Expand Down Expand Up @@ -124,9 +126,6 @@ const PortalRenaming = (props) => {
saveToSessionStorage("portalName", "");
setShowReminder(false);
}

//TODO: delete?
checkChanges();
};

const onValidateInput = (value) => {
Expand Down Expand Up @@ -177,10 +176,8 @@ const PortalRenaming = (props) => {
if (settingIsEqualInitialValue(value)) {
saveToSessionStorage("portalName", "");
saveToSessionStorage("portalNameDefault", "");
setShowReminder(false);
} else {
saveToSessionStorage("portalName", value);
setShowReminder(true);
}

checkChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,16 @@ class WelcomePageSettings extends React.Component {

componentDidMount() {
const { isLoaded, setIsLoadedWelcomePageSettings, tReady } = this.props;
const { greetingTitleDefault } = this.state;
window.addEventListener("resize", this.checkInnerWidth);

const isLoadedSetting = isLoaded && tReady;

if (isLoadedSetting) setIsLoadedWelcomePageSettings(isLoadedSetting);

if (greetingTitleDefault) {
this.checkChanges();
}
}

componentDidUpdate(prevProps, prevState) {
Expand Down

0 comments on commit 596153a

Please sign in to comment.