Skip to content

Commit

Permalink
Merge pull request #88 from ant-design/fix/nanoid
Browse files Browse the repository at this point in the history
🐛 fix: 修复crypto.randomUUID 在 http 中无法使用的问题
  • Loading branch information
ONLY-yours authored Sep 13, 2023
2 parents 574bad9 + a2ec772 commit 6158fee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"lodash.unionby": "^4.8.0",
"lodash.uniq": "^4.5.0",
"mockjs": "^1.1.0",
"nanoid": "^5.0.1",
"polished": "^4.2.2",
"prettier": "^2.8.8",
"rc-util": "^5.37.0",
Expand Down
3 changes: 2 additions & 1 deletion src/SortableList/utils/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { UniqueIdentifier } from '@dnd-kit/core';
import isEqual from 'lodash.isequal';
import { nanoid } from 'nanoid';
import { useEffect, useState } from 'react';

const defaultInitializer = (index: number) => index;
Expand Down Expand Up @@ -66,5 +67,5 @@ export const getIndexOfActiveItem = (list: any[], id?: UniqueIdentifier) => {
};

export const getUUID = (index) => {
return process.env.NODE_ENV === 'test' ? `test-${index}` : crypto.randomUUID();
return process.env.NODE_ENV === 'test' ? `test-${index}` : nanoid();
};

0 comments on commit 6158fee

Please sign in to comment.