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 blank screen on home page #4575

Merged
merged 2 commits into from Mar 15, 2022
Merged

Conversation

logseq-cldwalker
Copy link
Collaborator

@logseq-cldwalker logseq-cldwalker commented Mar 14, 2022

This fixes #4539 where two users had shared default-queries that were causing their home screen to crash. This PR also improves the error handling of default-queries so that any future errors render an inline error instead of blanking the screen like:
Screen Shot 2022-03-14 at 12 32 33 PM

This PR also introduces a reusable block-error component and uses it when advanced queries fail to parse correctly. Before it looked like:

Screen Shot 2022-03-14 at 4 27 46 PM

and now the error looks like:
Screen Shot 2022-03-14 at 4 37 21 PM

If we like this block-error component, I could use it in a couple more places where we render blocks errors with div.warning ...

Also used this on malformed advanced queries to improve styling and
communication of error
@@ -147,11 +147,15 @@
(when (seq queries)
[:div#today-queries.mt-10
(for [query queries]
(rum/with-key
(block/custom-query {:attr {:class "mt-10"}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Weirdly enough, this component has a catch-error but it was not taking effect

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that rum components don't catch errors in both :init and :will-component lifecycles.
https://github.com/tonsky/rum/blob/gh-pages/src/rum/core.clj#L131-L138

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's likely that lifecycle hooks have something to do with it but wouldn't explain why the page component works while custom-query doesn't

@logseq-cldwalker logseq-cldwalker marked this pull request as ready for review March 14, 2022 21:24
@logseq-cldwalker logseq-cldwalker requested review from tiensonqin, xyhp915, andelf, cnrpman and llcc and removed request for tiensonqin March 14, 2022 21:24
Copy link
Contributor

@llcc llcc left a comment

Choose a reason for hiding this comment

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

LGTM

@tiensonqin tiensonqin merged commit dc7e411 into master Mar 15, 2022
@tiensonqin tiensonqin deleted the fix/blank-screen-from-default-queries branch March 15, 2022 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

all disappear with version > 0.62
3 participants