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

UUID dep is out of date and throwing a warning on install #1106

Closed
alanbsmith opened this issue Jun 11, 2021 · 1 comment · Fixed by #1408
Closed

UUID dep is out of date and throwing a warning on install #1106

alanbsmith opened this issue Jun 11, 2021 · 1 comment · Fixed by #1408
Labels
5.x bug Something isn't working

Comments

@alanbsmith
Copy link
Member

🐛 Bug Report

When I installed our packages, I got the following warning:

warning @workday/canvas-kit-react > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

To Reproduce

npx create-react-app test-app
cd test-app
yarn add @workday/canvas-kit-react

Expected Behavior

No warnings

Actual Results

Browser (if applicable)

n/a

Link to repl or repo (highly encouraged)

n/a

@alanbsmith alanbsmith added the bug Something isn't working label Jun 11, 2021
NicholasBoll added a commit to NicholasBoll/canvas-kit that referenced this issue Jan 5, 2022
@NicholasBoll NicholasBoll linked a pull request Jan 5, 2022 that will close this issue
6 tasks
workday-canvas-kit pushed a commit that referenced this issue Jan 7, 2022
Our current id generation has issues.

- It generates very long ids that add noise to the page
- It is possible to generate a blank id
- Id generation is slow
- Snapshot tests require mocking the `uuid` module

Fixes: #1311, #1106, #664, #602

[category:Hooks]

Release Note:
**NOTE for jest snapshots**: This change removes the `uuid` package and instead will generate a one-time client seed and then create auto-incrementing ids. This change will not break UI or automated UI tests. It will break snapshot tests however. Previously, the only way to get stable ids for snapshot tests was to mock the `uuid` module. This was an implementation detail. To make snapshots work again, add the following to your jest setup file:

```ts
import {setUniqueSeed, resetUniqueIdCount} from '@workday/canvas-kit-react/common';

beforeEach(() => {
  setUniqueSeed('a'); // force set the seed
  resetUniqueIdCount(); // reset the unique id count
});
```

This will ensure each Jest snapshot has ids that look like `a0` and `a1` and will be the same every time the snapshot is run. Do not use these methods in production though - it may lead to inaccessible applications due to IDREF collisions.
@NicholasBoll
Copy link
Member

Closed by #1408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.x bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants