-
Notifications
You must be signed in to change notification settings - Fork 66
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
LG-4622: Adds a loading state to the Chart
component
#2652
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: fc8e9e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…charts-loading-state
charts/core/src/Chart/Chart.types.ts
Outdated
/** | ||
* Controlled loading state. | ||
*/ | ||
isLoading?: boolean; |
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.
is there any possibility we might want to render an error if chart data doesn't load or encounters some other issue? if so, I'm curious what you think about using a more extensible enum rather than a boolean for state
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 is a very good callout. Internal Tools had mentioned an error state as well and I meant to talk to Sooa about this. There's nothing in the designs for this but there probably should be. I will definitely update it so that there's an enum rather than a boolean for this case, and I'll ping design about the error state (though will probably add that separately, assuming design wants it)
export const ChartStates = { | ||
Default: 'default', | ||
Loading: 'loading', | ||
} as const; | ||
export type ChartStates = (typeof ChartStates)[keyof typeof ChartStates]; |
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 also have loading/error states in Combobox
and SearchInput
and those use Unset: 'unset'
instead of Default: 'default'
. Can we use the same for consistency?
leafygreen-ui/packages/combobox/src/types/Combobox.types.ts
Lines 53 to 58 in c406ab8
export const SearchState = { | |
Unset: 'unset', | |
Error: 'error', | |
Loading: 'loading', | |
} as const; | |
export type SearchState = (typeof SearchState)[keyof typeof SearchState]; |
✍️ Proposed changes
Chart
component🎟 Jira ticket: LG-4622
✅ Checklist
For bug fixes, new features & breaking changes
pnpm changeset
and documented my changesFor new components
🧪 How to test changes
Test via
isLoading
prop in storybookScreenshot