Skip to content

Commit 3907875

Browse files
committed
use nanoid for unique id
1 parent 25f2e4a commit 3907875

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

package-lock.json

Lines changed: 27 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/golden-layout/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"type": "module",
1212
"dependencies": {
1313
"@deephaven/components": "file:../components",
14-
"jquery": "^3.6.0"
14+
"jquery": "^3.6.0",
15+
"nanoid": "^5.0.7"
1516
},
1617
"peerDependencies": {
1718
"react": ">=16.8.0",

packages/golden-layout/src/utils/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import $ from 'jquery';
2+
import { nanoid } from 'nanoid'
23

34
export function getHashValue(key: string) {
45
var matches = location.hash.match(new RegExp(key + '=([^&]*)'));
@@ -40,7 +41,7 @@ export function removeFromArray<T>(item: T, array: T[]) {
4041
}
4142

4243
export function getUniqueId() {
43-
return (Math.random() * 1000000000000000).toString(36).replace('.', '');
44+
return nanoid();
4445
}
4546

4647
/**

0 commit comments

Comments
 (0)