8000 [ENHANCEMENT] Use a context for the config to share it across the whole app by Nexucis · Pull Request #1604 · perses/perses · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[ENHANCEMENT] Use a context for the config to share it across the whole app #1604

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

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

Nexucis
Copy link
Member
@Nexucis Nexucis commented Nov 27, 2023

This PR is just refactoring the way to access the config. I'm introducing a context so the different component can have access to the config without having to deal with async and network issue.

Today the config is already heavily use and I think it makes sense to simplify the usage and its access of it.

I find the code cleaner with this way (but perhaps it's just matter of test ;))

export function ConfigContextProvider(props: { children: React.ReactNode }) {
const { data, isLoading } = useConfig();
if (isLoading || data === undefined) {
return <></>;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return <></>;
return <Stack width="100%" sx={{ alignItems: 'center', justifyContent: 'center' }}>
<CircularProgress />
</Stack>;

Copy link
Member Author

Choose a reason for hiding this comment

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

okey. I just wished we would have the Perses logo animated instead of the MUI spinner 😢

…le app

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
@Nexucis Nexucis force-pushed the nexucis/config-context branch from c5fec4b to 2980088 Compare November 27, 2023 10:01
Copy link
Member
@Gladorme Gladorme left a comment

Choose a reason for hiding this comment

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

LGTM 😄

@Nexucis Nexucis enabled auto-merge (squash) November 27, 2023 10:03
@Nexucis Nexucis merged commit 279b4e2 into main Nov 27, 2023
@Nexucis Nexucis deleted the nexucis/config-context branch November 27, 2023 10:14
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.

2 participants
0