mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 11:56:29 +00:00
fix: merge conflict
This commit is contained in:
parent
b46214acbd
commit
55d055f801
18
packages/core/client/src/schema-component/context.tsx
Normal file
18
packages/core/client/src/schema-component/context.tsx
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import React, { FC, createContext, useMemo } from 'react';
|
||||||
|
import { ISchemaComponentContext } from './types';
|
||||||
|
|
||||||
|
export const SchemaComponentContext = createContext<ISchemaComponentContext>({});
|
||||||
|
SchemaComponentContext.displayName = 'SchemaComponentContext';
|
||||||
|
export const SchemaComponentChangelessContext = createContext<ISchemaComponentContext>({});
|
||||||
|
SchemaComponentChangelessContext.displayName = 'SchemaComponentChangelessContext';
|
||||||
|
|
||||||
|
export const SchemaComponentContextProvider: FC<{ value: ISchemaComponentContext }> = ({ children, value }) => {
|
||||||
|
const changelessContextValue = useMemo(() => {
|
||||||
|
return value;
|
||||||
|
}, Object.values(value));
|
||||||
|
return <SchemaComponentContext.Provider value={value}>
|
||||||
|
<SchemaComponentChangelessContext.Provider value={changelessContextValue}>
|
||||||
|
{children}
|
||||||
|
</SchemaComponentChangelessContext.Provider>
|
||||||
|
</SchemaComponentContext.Provider>;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user