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

Revert back to external uuid function #11692

Merged
merged 1 commit into from
Nov 26, 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"tsconfig-paths-webpack-plugin": "^3.2.0",
"typescript": "^5.2.2",
"unified": "^10.1.2",
"uuid": "^11.0.3",
"watchpack": "^2.4.0",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4",
Expand Down
3 changes: 2 additions & 1 deletion resources/js/models/chat/create-announcement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import UserJson from 'interfaces/user-json';
import { action, autorun, computed, makeObservable, observable } from 'mobx';
import { present } from 'utils/string';
import { v4 as uuidv4 } from 'uuid';
import { maxMessageLength } from './channel';

interface LocalStorageProps extends Record<InputKey, string> {
Expand Down Expand Up @@ -33,7 +34,7 @@ export default class CreateAnnouncement {
@observable validUsers = new Map<number, UserJson>();

private initialized = false;
private readonly uuid = crypto.randomUUID();
private readonly uuid = uuidv4();

@computed
get errors() {
Expand Down
3 changes: 2 additions & 1 deletion resources/js/models/chat/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { action, computed, makeObservable, observable } from 'mobx';
import User from 'models/user';
import * as moment from 'moment';
import core from 'osu-core-singleton';
import { v4 as uuidv4 } from 'uuid';

export default class Message {
@observable channelId = -1;
@observable content = '';
@observable errored = false;
@observable isAction = false;
@observable messageId: number | string = crypto.randomUUID();
@observable messageId: number | string = uuidv4();
@observable persisted = false;
@observable senderId = -1;
@observable timestamp: string = moment().toISOString();
Expand Down
3 changes: 2 additions & 1 deletion resources/js/utils/turbolinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.

import { VisitOptions } from '@hotwired/turbo';
import { v4 as uuidv4 } from 'uuid';

export function currentUrl() {
return window.newUrl ?? document.location;
Expand Down Expand Up @@ -59,7 +60,7 @@ export function updateHistory(url: string, action: 'push' | 'replace') {
const newLocation = new URL(url, document.baseURI);

const callback = () => {
Turbo.session.history[action](newLocation, crypto.randomUUID());
Turbo.session.history[action](newLocation, uuidv4());
Turbo.session.view.lastRenderedLocation = newLocation;
};
if (action === 'replace' && window.newUrl == null) {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7611,6 +7611,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=

uuid@^11.0.3:
version "11.0.3"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-11.0.3.tgz#248451cac9d1a4a4128033e765d137e2b2c49a3d"
integrity sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg==

uuid@^8.3.0:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
Expand Down