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

Made the examples self contained #5

Closed
wants to merge 5 commits into from

Conversation

leroydev
Copy link
Contributor

Closes #4.
Also makes all the examples lazy loaded. This should speed up first load speed of the examples website but should be tested whether this works properly in a production build too. Locally for me with a production build served with http-server it did work.

…n loaded fresh;

This should also make the first load of the antd examples faster as it doesn't need to load every example when just one gets visited
…er when loaded fresh;

This should also make the first load of the Formik+MUI examples faster as it doesn't need to load every example when just one gets visited
@supnate
Copy link
Collaborator

supnate commented Mar 21, 2024

Hi @leroydev , thank you very much for deep dive into code and propose optimization!

However, adapter is designed to be a global config. Just like you need to config global providers for redux, some UI libs, etc. So using nice form consists of two parts, one for config and the other is real usage.

@leroydev
Copy link
Contributor Author

leroydev commented Mar 21, 2024

Hi @supnate, thanks for taking the time to review quickly!
What do you think about adding a comment above the example code that adds the adapters, that mentions this should only be done globally but is done within the example to make them self-contained?
Then you have the best of both worlds, users can more quickly setup an example locally to play around with it and it is clear to them that the adapters is supposed to be global configuration.

If not, I do feel that including the definition of the custom datepicker in each example does add value.
Otherwise the user will be searching for a bit and would have to run into the one example that does have that code in it.

And the lazy loading should make the docs faster to load so might also be an improvement you want to consider.

Let me know which parts you want in what form and I'll make adjustments 🙂

@supnate
Copy link
Collaborator

supnate commented Mar 24, 2024

Thanks @leroydev .

  1. The get started section in readme should help users to know how to configure nice form. Examples mainly shows different scenarios of usage.
  2. For widget definition, we think it's usually configured globally for common widgets to avoid duplicated code. But I agree adding a doc link would be helpful.
  3. Lazy load for examples code is good change 👍

@leroydev
Copy link
Contributor Author

Closed in favor of #6

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.

The examples aren't self-contained
2 participants