-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Routing Refactor #717
Routing Refactor #717
Conversation
@timgl this is ready for review! @EDsCODE in case you have time, you may check it as well... if now, please at least read the parts about kea-router below, as these will be useful going forward. I managed to find, fix and clean up a lot of stuff as I went through the files. This includes a lot of I untangled a lot of logic regarding the routes, filters, etc and gave things a much stronger foundation. Now using kea-router, it's joyful to use the URL search parameters to store and all sorts of filters. I also removed the darkness from the loading screens and used the default antd spinner. At the end, I went through and tested all the pages I could find in the menu and clicked all the buttons I could find... and things work. That said, it's possible I might have mixed something, so a thorough QA is very much appreciated. Now, at least for me, when I move around posthog, all links, filters, etc work the way they should, sparking unimaginable joy! :D |
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.
</tr> | ||
</thead> | ||
<tbody> | ||
{isLoading && <TableRowLoading colSpan={5} />} |
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.
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.
Good catch! I didn't test changing filters in this table after changing the loaders, even though it's quite an obvious issue. I fixed it now for this table and for the others: if there are any rows already shown in the table, the loader is an overlay. Otherwise it's like on your screenshot, except of course without the table rows.
For added joy, I implemented a feature for the events table, which will show the loading overlay only after it has been loading for 500ms. Thus it's possible most people will never even see a loader anymore, except on the initial page load.
I can change that delay in case you have some better number to suggest.
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.
Looks good
<div /> | ||
<Spin /> |
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.
There's no loader when changing the date. willing to accept out of scope for this PR
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.
That scene could use a good refactor :). I'd say it's outside the scope of this PR, as nothing changed on Paths from before, except just the addition of the spinner on the (shown-once) loading screen.
Hey, regarding the bundle splitting, yeah, we should finetune it manually later. However webpack's defaults already improve the downloaded JS size quite a bit.
I guess it makes a difference and we can adjust the splitting later to be more precise. |
I found a few more bugs that got squashed:
Plus one extra feature: I removed the |
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.
LGTM
Changes
This is turning into a pretty lofty PR and is still Work In Progress. Things done so far:
actionToUrl
andurlToAction
functions work much better and all logic about the state of the app is also now in one place (kea).<Router />
code anyway, I just added code splitting as well. Loading of the different scenes is also quite intelligent. When you open a new scene by changing the URL (/dashboard -> /people), we start loading it in the background. If it is loaded within 0.5sec, we show it directly. Only if it takes longer than half a second to load, do we show a spinner. This makes the app feel much snappier.Still todo:
Maybe:
Checklist