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

Feature Request: Enhancing <CheckForApplicationUpdate> for module federation apps #9432

Closed
smeng9 opened this issue Nov 9, 2023 · 1 comment · Fixed by #9437
Closed

Feature Request: Enhancing <CheckForApplicationUpdate> for module federation apps #9432

smeng9 opened this issue Nov 9, 2023 · 1 comment · Fixed by #9437

Comments

@smeng9
Copy link
Contributor

smeng9 commented Nov 9, 2023

Is your feature request related to a problem? Please describe.

  1. Our application uses the module federation design but the <CheckForApplicationUpdate> can only check for a single url. It cannot check multiple urls for each module

  2. Additionally the fetch function in getHashForUrl

    does not support passing additional options like cache control, so even after the interval has passed, it may check for a stale copy of data from cache which breaks the purpose of CheckForApplicationUpdate. This may be a bug.

  3. We would also like an additional callback function handleApplicationUpdate passed into the <CheckForApplicationUpdate> so we can customize the button click behavior

    like making backup of localstorage, give user warning about potential data loss, etc.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Enhance the <CheckForApplicationUpdate> interface to make url support an array of strings, add the fetch options object, and add the callback.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Stack a bunch of CheckForApplicationUpdate in the layout, each checking for a single url. However that would not solve problem 2 and 3.
Hope these enhancement can benefit other people so they don't have to reimplement the react hooks.

Additional context
Add any other context or screenshots about the feature request here.

@fzaninotto
Copy link
Member

Hi, and thanks for your feedback.

Regarding your points:

  1. The CheckForApplicationUpdate component won't support module federation. You will have to build your own component for that.
  2. We're open to a PR adding the support for an options prop passed as second argument to fetch
  3. It's already possible: the parameter is called onNewVersionAvailable. We do need to document it, though, so I'm marking this as a documentation issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants