diff --git a/src/App.tsx b/src/App.tsx index eefe22c..3c4162c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -22,6 +22,7 @@ import userMediaStats from "./resources/user_media_statistics"; import users from "./resources/users"; import authProvider from "./synapse/authProvider"; import dataProvider from "./synapse/dataProvider"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; // TODO: Can we use lazy loading together with browser locale? const messages = { @@ -46,37 +47,41 @@ const i18nProvider = polyglotI18nProvider( ] ); +const queryClient = new QueryClient(); + const App = () => ( - - - } /> - - - - - - - - - - - - - - - - - - - + + + + } /> + + + + + + + + + + + + + + + + + + + + ); export default App; diff --git a/src/components/mxid.tsx b/src/components/mxid.tsx index cf8870e..0600a26 100644 --- a/src/components/mxid.tsx +++ b/src/components/mxid.tsx @@ -1,10 +1,11 @@ +import { Identifier } from "ra-core"; /** * Check if a user is managed by an application service * @param id The user ID to check * @returns Whether the user is managed by an application service */ -export const isASManaged = (id: string): boolean => { +export const isASManaged = (id: string | Identifier): boolean => { const managedUsersString = localStorage.getItem("as_managed_users") || ''; try { const asManagedUsers = JSON.parse(managedUsersString).map(regex => new RegExp(regex)); diff --git a/src/resources/users.tsx b/src/resources/users.tsx index f79d6b7..c16220c 100644 --- a/src/resources/users.tsx +++ b/src/resources/users.tsx @@ -244,6 +244,10 @@ export const UserCreate = (props: CreateProps) => ( const UserTitle = () => { const record = useRecordContext(); + if (!record) { + return null; + } + const translate = useTranslate(); let username = record ? (record.displayname ? `"${record.displayname}"` : `"${record.name}"`) : "" if (isASManaged(record?.id)) { @@ -360,7 +364,7 @@ export const UserEdit = (props: EditProps) => { } path="devices"> - +