-
Notifications
You must be signed in to change notification settings - Fork 1
fix: don't break the page structure while loading data for the headerbar #7
Conversation
const locale = data.user.settings.keyUiLocale || 'en' | ||
i18n.changeLanguage(locale) | ||
if (!loading) { | ||
// TODO: This will run every render which is probably wrong! Also, setting the global locale shouldn't be done in the headerbar |
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.
This shouldn't be in headerbar I don't think....
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.
Agreed. I forgot to remove this after implementing i18n. It should be moved to the Storybook part since it simulates the App role.
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.
Should we do that in another PR then?
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.
Yeah, just leave it as it is with the TODO
and we can do it in a different 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.
Looks good. Is it a draft because the related PR needs a merge first or is there other work you want to do on it?
I get an error on the Netlify deploy preview: https://deploy-preview-7--dhis2-ui-widgets.netlify.com/?path=/story/headerbar--loading: |
Yep, the Storybook error on Netlify and the drafty nature of this PR are both because of the prerequisite app-runtime 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.
Nice! Looks good. I'll have a think about a possible loading state.
Works! And this repo is semantic release enabled so will roll out when you merge it. |
Merged! @varl might recommend forcing squash-and-merge, doesn't appear to be required in this repo. |
## [1.0.3](v1.0.2...v1.0.3) (2019-05-28) ### Bug Fixes * don't break the page structure while loading data for the headerbar ([#7](#7)) ([eae0a16](eae0a16))
🎉 This PR is included in version 1.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Requires dhis2/app-runtime#11 to support loading states in Storybook.
Instead of rendering the disruptive and ugly
...
paceholder while waiting for initial data to load, this keeps the macro structure of the headerbar in place but omits the data-dependent content. It will make page loads less jerky. We may want to indicate the loading state in some subtle way as well (@cooper-joe) but that can be a separate change.I also added a loading state story to the storybook.