perf: pass app data to OmniInstallAppButton to avoid redundant API calls (#26156)
* perf: pass app data to OmniInstallAppButton to avoid redundant API calls * Clean up comments in OmniInstallAppButton component Removed comment about pre-fetched app data and fetching logic.
This commit is contained in:
1 parent
efcf68869d
commit
2689cdfdff
3 files changed
+15
-4
No files matched your search
@@ -2,13 +2,13 @@ import { useSession } from "next-auth/react";
|
||||
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
export default function useApp(appId: string) {
|
||||
export default function useApp(appId: string, options?: { enabled?: boolean }) {
|
||||
const { status } = useSession();
|
||||
|
||||
return trpc.viewer.apps.appById.useQuery(
|
||||
{ appId },
|
||||
{
|
||||
enabled: status === "authenticated",
|
||||
enabled: status === "authenticated" && (options?.enabled ?? true),
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user