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

Use uuid v7 instead of v4 #4052

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions client/packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,14 @@
"recharts": "^2.5.0",
"stylis": "^4.0.13",
"stylis-plugin-rtl": "^2.1.1",
"uuid": "^9.0.0",
"uuidv7": "^1.0.0",
"zustand": "^4.3.6"
},
"devDependencies": {
"@types/autosuggest-highlight": "^3.2.0",
"@types/css-mediaquery": "^0.1.1",
"@types/dompurify": "^3.0.0",
"@types/js-cookie": "^3.0.1",
"@types/uuid": "^9.0.1",
"css-mediaquery": "^0.1.2"
}
}
4 changes: 2 additions & 2 deletions client/packages/common/src/utils/functions/FnUtils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { UUID } from '@common/types';
import { v4 } from 'uuid';
import { uuidv7 } from 'uuidv7';

export const FnUtils = {
generateUUID: (): UUID => v4(),
generateUUID: (): UUID => uuidv7(),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
debounce: <T extends (...args: any[]) => any>(
callback: T,
Expand Down
10 changes: 5 additions & 5 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5209,11 +5209,6 @@
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.7.tgz#5b06ad6894b236a1d2bd6b2f07850ca5c59cf4d6"
integrity sha512-cputDpIbFgLUaGQn6Vqg3/YsJwxUwHLO13v3i5ouxT4lat0khip9AEWxtERujXV9wxIB1EyF97BSJFt6vpdI8g==

"@types/uuid@^9.0.1":
version "9.0.2"
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.2.tgz#ede1d1b1e451548d44919dc226253e32a6952c4b"
integrity sha512-kNnC1GFBLuhImSnV7w4njQkUiJi0ZXUycu1rUaouPqiKlXkh77JKgdRnTAp1x5eBwcIwbtI+3otwzuIDEuDoxQ==

"@types/ws@^8.0.0", "@types/ws@^8.5.5":
version "8.5.5"
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.5.tgz#af587964aa06682702ee6dcbc7be41a80e4b28eb"
Expand Down Expand Up @@ -18337,6 +18332,11 @@ uuid@^9.0.0:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==

uuidv7@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/uuidv7/-/uuidv7-1.0.0.tgz#b097dd0d48c5e48edf661199e033f10ebee08cda"
integrity sha512-XkvPwTtSmYwxIE1FSYQTYg79zHL1ZWV5vM/Qyl9ahXCU8enOPPA4bTjzvafvYUB7l2+miv4EqK/qEe75cOXIdA==

v8-compile-cache@2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"
Expand Down
7 changes: 7 additions & 0 deletions server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ path = "src/lib.rs"

[dependencies]
sha2 = "0.10.2"
uuid = { version = "1.0.0", features = ["v4"] }
uuid = { version = "1.8.0", features = ["v7"] }
chrono = { workspace = true }
serde = "1.0.126"
env_logger = "0.8.3"
Expand Down
2 changes: 1 addition & 1 deletion server/util/src/uuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use uuid::Uuid;

/// Generates unique id
pub fn uuid() -> String {
Uuid::new_v4().to_string()
Uuid::now_v7().to_string()
}

pub fn small_uuid() -> String {
Expand Down
Loading