Switch to React18 useId (#28651)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/28655/head
							parent
							
								
									9bf3d22439
								
							
						
					
					
						commit
						7e03f38a3b
					
				|  | @ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only | |||
| Please see LICENSE files in the repository root for full details. | ||||
| */ | ||||
| 
 | ||||
| import React, { ReactNode, createRef, useCallback, useEffect, useState } from "react"; | ||||
| import React, { ReactNode, createRef, useCallback, useEffect, useState, useId } from "react"; | ||||
| import EditIcon from "@vector-im/compound-design-tokens/assets/web/icons/edit"; | ||||
| import UploadIcon from "@vector-im/compound-design-tokens/assets/web/icons/share"; | ||||
| import DeleteIcon from "@vector-im/compound-design-tokens/assets/web/icons/delete"; | ||||
|  | @ -16,7 +16,6 @@ import classNames from "classnames"; | |||
| import { _t } from "../../../languageHandler"; | ||||
| import { mediaFromMxc } from "../../../customisations/Media"; | ||||
| import { chromeFileInputFix } from "../../../utils/BrowserWorkarounds"; | ||||
| import { useId } from "../../../utils/useId"; | ||||
| import AccessibleButton from "../elements/AccessibleButton"; | ||||
| import BaseAvatar from "../avatars/BaseAvatar"; | ||||
| import Modal from "../../../Modal.tsx"; | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only | |||
| Please see LICENSE files in the repository root for full details. | ||||
| */ | ||||
| 
 | ||||
| import React, { ChangeEvent, ReactNode, useCallback, useEffect, useMemo, useState } from "react"; | ||||
| import React, { ChangeEvent, ReactNode, useCallback, useEffect, useMemo, useState, useId } from "react"; | ||||
| import { logger } from "matrix-js-sdk/src/logger"; | ||||
| import { EditInPlace, Alert, ErrorMessage } from "@vector-im/compound-web"; | ||||
| import PopOutIcon from "@vector-im/compound-design-tokens/assets/web/icons/pop-out"; | ||||
|  | @ -20,7 +20,6 @@ import { formatBytes } from "../../../utils/FormattingUtils"; | |||
| import { useToastContext } from "../../../contexts/ToastContext"; | ||||
| import InlineSpinner from "../elements/InlineSpinner"; | ||||
| import UserIdentifierCustomisations from "../../../customisations/UserIdentifier"; | ||||
| import { useId } from "../../../utils/useId"; | ||||
| import CopyableText from "../elements/CopyableText"; | ||||
| import { useMatrixClientContext } from "../../../contexts/MatrixClientContext"; | ||||
| import AccessibleButton from "../elements/AccessibleButton"; | ||||
|  |  | |||
|  | @ -1,16 +0,0 @@ | |||
| /* | ||||
| Copyright 2024 New Vector Ltd. | ||||
| Copyright 2024 The Matrix.org Foundation C.I.C. | ||||
| 
 | ||||
| SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only | ||||
| Please see LICENSE files in the repository root for full details. | ||||
| */ | ||||
| 
 | ||||
| import React from "react"; | ||||
| 
 | ||||
| const getUniqueId = (() => { | ||||
|     return () => `:r${Math.random()}:`; | ||||
| })(); | ||||
| 
 | ||||
| // Replace this with React's own useId once we switch to React 18
 | ||||
| export const useId = (): string => React.useMemo(getUniqueId, []); | ||||
		Loading…
	
		Reference in New Issue
	
	 Michael Telatynski
						Michael Telatynski