-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Initial Load Flickering. #2395
Conversation
); | ||
} else { | ||
dispatch( | ||
act.UPDATE_USER_PAYWALL_STATUS({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we rely on this action to determine if the user has paid or not
@@ -17,7 +17,8 @@ const PaywallMessage = ({ wrapper, ...props }) => { | |||
title: "Complete your registration", | |||
onClose: handleCloseModal | |||
}); | |||
const showMessage = !!currentUserEmail && !isPaid; | |||
const showMessage = !!currentUserEmail && isPaid === false && isPaid !== null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If isPaid
is null we don't want to show the message as this means the isPaid info not available yet.
@@ -29,16 +28,13 @@ const Loader = ({ children }) => { | |||
try { | |||
const apiInfo = await onRequestApiInfo(false); | |||
setApiInfo(apiInfo); | |||
if (apiInfo.activeusersession) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have the same check already in onRequestApiInfo
.
|
||
return update(["byUserID", userid], (paywall) => ({ | ||
...paywall, | ||
isPaid: paywalladdress === "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now we update isPaid
only when on UPDATE_USER_PAYWALL_STATUS
action, as the backend returns explicit
haspaid
field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to elaborate on this:
this was an issue for paid users; isPaid: paywalladdress === ""
=> resulted in isPaid = false
this why the paywall message was visible for few moments until UPDATE_USER_PAYWALL_STATUS
was dispatched with status paid which switched isPaid
to true and only then the paywall message disappeared.
318e6aa
to
42edcd3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tiagoalvesdulce Thanks for the screen record, I would like to fix that in this PR, the paywall shouldn't flicker like that, |
OK, I'll create an issue. |
This improves the initial load flickering, before this the paywall message was displayed for some time and then
when the paywall info received from backend the message was gone.
This commit changes this behavior to hide the message by default and only after receiving from the backend that user
hasn't paid the message would show up.
Closes #2395.