chore: update prettier configuration for print width (#519)
* feat: update prettier configuration for print width * chore: apply code formatting to entire repository * fix: remove build files * fix: format issue --------- Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
@@ -12,31 +12,21 @@ type Data = Record<
|
||||
>;
|
||||
|
||||
interface GlobalItemServerDataContext {
|
||||
setItemServerData: (
|
||||
id: string,
|
||||
data: Record<string, unknown> | undefined,
|
||||
) => void;
|
||||
setItemServerData: (id: string, data: Record<string, unknown> | undefined) => void;
|
||||
data: Data;
|
||||
initalItemIds: string[];
|
||||
}
|
||||
|
||||
const GlobalItemServerDataContext =
|
||||
createContext<GlobalItemServerDataContext | null>(null);
|
||||
const GlobalItemServerDataContext = createContext<GlobalItemServerDataContext | null>(null);
|
||||
|
||||
interface Props {
|
||||
initalItemIds: string[];
|
||||
}
|
||||
|
||||
export const GlobalItemServerDataProvider = ({
|
||||
children,
|
||||
initalItemIds,
|
||||
}: PropsWithChildren<Props>) => {
|
||||
export const GlobalItemServerDataProvider = ({ children, initalItemIds }: PropsWithChildren<Props>) => {
|
||||
const [data, setData] = useState<Data>({});
|
||||
|
||||
const setItemServerData = (
|
||||
id: string,
|
||||
itemData: Record<string, unknown> | undefined,
|
||||
) => {
|
||||
const setItemServerData = (id: string, itemData: Record<string, unknown> | undefined) => {
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
[id]: {
|
||||
@@ -47,9 +37,7 @@ export const GlobalItemServerDataProvider = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<GlobalItemServerDataContext.Provider
|
||||
value={{ setItemServerData, data, initalItemIds }}
|
||||
>
|
||||
<GlobalItemServerDataContext.Provider value={{ setItemServerData, data, initalItemIds }}>
|
||||
{children}
|
||||
</GlobalItemServerDataContext.Provider>
|
||||
);
|
||||
@@ -73,10 +61,7 @@ export const useServerDataFor = (id: string) => {
|
||||
return context.data[id];
|
||||
};
|
||||
|
||||
export const useServerDataInitializer = (
|
||||
id: string,
|
||||
serverData: Record<string, unknown> | undefined,
|
||||
) => {
|
||||
export const useServerDataInitializer = (id: string, serverData: Record<string, unknown> | undefined) => {
|
||||
const context = useContext(GlobalItemServerDataContext);
|
||||
|
||||
if (!context) {
|
||||
|
||||
@@ -14,11 +14,7 @@ type Props = PropsWithChildren<{
|
||||
board: Board;
|
||||
}>;
|
||||
|
||||
export const GlobalItemServerDataRunner = ({
|
||||
board,
|
||||
shouldRun,
|
||||
children,
|
||||
}: Props) => {
|
||||
export const GlobalItemServerDataRunner = ({ board, shouldRun, children }: Props) => {
|
||||
if (!shouldRun) return children;
|
||||
|
||||
const allItems = board.sections.flatMap((section) => section.items);
|
||||
@@ -45,10 +41,7 @@ const ItemDataLoader = async ({ item }: ItemDataLoaderProps) => {
|
||||
return <ClientServerDataInitalizer id={item.id} serverData={undefined} />;
|
||||
}
|
||||
const loader = await widgetImport.serverDataLoader();
|
||||
const optionsWithDefault = reduceWidgetOptionsWithDefaultValues(
|
||||
item.kind,
|
||||
item.options,
|
||||
);
|
||||
const optionsWithDefault = reduceWidgetOptionsWithDefaultValues(item.kind, item.options);
|
||||
const data = await loader.default({
|
||||
...item,
|
||||
options: optionsWithDefault as never,
|
||||
|
||||
Reference in New Issue
Block a user