Skip to content

Commit 2e84bdf

Browse files
committed
refactor: update types for data providers and add loading state to block components
1 parent 4f9fdc4 commit 2e84bdf

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

src/package/controls/types.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,12 @@ export interface ChaiBlockDefinition<T = Record<string, any>, K = Record<string,
1616
description?: string;
1717
blocks?: ChaiBlock[] | (() => ChaiBlock[]);
1818
category?: string;
19-
wrapper?: boolean;
20-
preview?: string;
2119
hidden?: boolean | ((parentType?: string) => boolean);
2220
icon?: React.ReactNode | React.ComponentType;
2321
builderComponent?: React.ComponentType<ChaiBlockComponentProps<T>>;
2422

2523
dataProvider?: (args: { lang: string; draft: boolean; inBuilder: boolean; block: ChaiBlock<T>; pageProps: K }) => K;
26-
mockDataProvider?: (args: {
27-
lang: string;
28-
draft: boolean;
29-
inBuilder: boolean;
30-
block: ChaiBlock<T>;
31-
pageProps: ChaiPageProps;
32-
}) => K;
24+
dataProviderDependencies?: string[];
3325

3426
//props
3527
schema?: ChaiBlockSchema;

src/package/v2/runtime/core.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export type ChaiBlock<T = Record<string, string>> = {
1414

1515
export type ChaiBlockComponentProps<T> = ChaiBlock<T> & {
1616
// Chai Block Props
17+
$loading?: boolean;
1718
blockProps: Record<string, string>;
1819
inBuilder: boolean;
1920
lang: string;

src/package/v2/runtime/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ export {
3636
};
3737

3838
export interface ChaiPageProps {
39-
[key: string]: any;
39+
slug: string;
40+
searchParams?: Record<string, string>;
4041
}

0 commit comments

Comments
 (0)