Skip to content

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

@Hyperkid123

Description

@Hyperkid123

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-

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions