Skip to content
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

Merged
merged 2 commits into from
May 19, 2021
Merged

Conversation

amass01
Copy link
Member

@amass01 amass01 commented May 12, 2021

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.

);
} else {
dispatch(
act.UPDATE_USER_PAYWALL_STATUS({
Copy link
Member Author

@amass01 amass01 May 12, 2021

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;
Copy link
Member Author

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) {
Copy link
Member Author

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 === ""
Copy link
Member Author

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.

Copy link
Member Author

@amass01 amass01 May 12, 2021

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.

Copy link
Member

@tiagoalvesdulce tiagoalvesdulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix your PR description, it should close the issue #2371.

I'm still seeing some ugly flickering in the UI contents. See:

flicker.mp4

I think the initial flicker reported by luke on #2371 is fixed so you can choose to create new issues to deal with the issues I mentioned above.

@amass01
Copy link
Member Author

amass01 commented May 18, 2021

@tiagoalvesdulce Thanks for the screen record, I would like to fix that in this PR, the paywall shouldn't flicker like that,
i didn't see that while testing tho, will try now using slower network using the dev tools.

@tiagoalvesdulce
Copy link
Member

OK, I'll create an issue.

@tiagoalvesdulce tiagoalvesdulce merged commit 27b16a3 into decred:master May 19, 2021
@amass01 amass01 deleted the initialflickering branch May 19, 2021 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants