🐛 fix(inputListComponent): set inputList state to value prop on value prop change to fix inputList not updating on prop change
🔒 chore(utils.ts): add random number to getRandomKeyByssmm function to reduce the chance of key collision
This commit is contained in:
parent
27d7553fb6
commit
4e01de9e39
2 changed files with 6 additions and 1 deletions
|
|
@ -19,6 +19,11 @@ export default function InputListComponent({
|
||||||
onChange([""]);
|
onChange([""]);
|
||||||
}
|
}
|
||||||
}, [disabled, onChange]);
|
}, [disabled, onChange]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setInputList(value);
|
||||||
|
}, [value]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
|
|
|
||||||
|
|
@ -971,5 +971,5 @@ export function getRandomKeyByssmm(): string {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const seconds = String(now.getSeconds()).padStart(2, "0");
|
const seconds = String(now.getSeconds()).padStart(2, "0");
|
||||||
const milliseconds = String(now.getMilliseconds()).padStart(3, "0");
|
const milliseconds = String(now.getMilliseconds()).padStart(3, "0");
|
||||||
return seconds + milliseconds;
|
return seconds + milliseconds + Math.abs(Math.floor(Math.random() * 10001));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue