Files
Pasquale Vitiello 9302c06311 refactor: align biome settings with calcom (#718)
* update biome config + resolve issues

* improve the ui:sync command to run organizeImports on packages

* reformat

* build registry

* exclude base-ui stuff

* fix useExportsLast

* further improvements

* silence errors

* exclude examples app

* update biome + reformat

* format all the other files

* include examples app

* improve copyable-field

* remove unwanted comment

* remove a few unneeded biome comments

* avoid nested ternary

* refactored some shared components

* upgrade base ui to 1.2.0

* fix
2026-03-11 23:09:19 +00:00

48 lines
1.2 KiB
TypeScript

"use client";
import type * as React from "react";
import type { Context } from "react";
import { createContext, type ReactNode, useContext, useState } from "react";
interface DebugContextValue {
enableArtificialDelay: boolean;
isLoadingOverride: boolean | null;
setEnableArtificialDelay: (value: boolean) => void;
setIsLoadingOverride: (value: boolean | null) => void;
}
const DebugContext: Context<DebugContextValue | null> =
createContext<DebugContextValue | null>(null);
export function DebugProvider({
children,
}: {
children: ReactNode;
}): React.ReactElement {
const [isLoadingOverride, setIsLoadingOverride] = useState<boolean | null>(
null,
);
const [enableArtificialDelay, setEnableArtificialDelay] = useState(false);
return (
<DebugContext.Provider
value={{
enableArtificialDelay,
isLoadingOverride,
setEnableArtificialDelay,
setIsLoadingOverride,
}}
>
{children}
</DebugContext.Provider>
);
}
export function useDebug(): DebugContextValue {
const context = useContext(DebugContext);
if (!context) {
throw new Error("useDebug must be used within a DebugProvider");
}
return context;
}