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

Bug - [GenerateId] - Generates duplicate id sequences if multiple versions of PF are loaded. #10160

Closed
Hyperkid123 opened this issue Mar 13, 2024 · 0 comments · Fixed by #10178
Assignees
Labels
Milestone

Comments

@Hyperkid123
Copy link
Contributor

Problem

Components that use the randomly generated IDs can have duplicate IDs, if a multiple versions of PF are loaded into the browser. A typical example is an environment that uses module federation.

How do you reproduce the problem?

Create a module federation environment, with 2 modules that share @patternfly/react-core using different versions so the modules do not meet the version range requirements.

Use some components that use the GenerateId wrapper. There will be duplicate IDs

Expected behavior
Each ID will be unique.

Is this issue blocking you?
Causes some bugs in HCC

Screenshots
image

Possible fixes

  1. Make the sequence global by storing the current sequence value in the globalThis:

  2. Add some random string to the prefix so each module instance has a unique prefix:

    something like pf-random-id-111-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
3 participants