mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
fix(data-vi): "Current popup record" variable issue (#5984)
This commit is contained in:
parent
b1b1dc6f13
commit
72255250fa
@ -9,17 +9,28 @@
|
||||
|
||||
import React from 'react';
|
||||
import { BlockRefreshButton } from '../initializers/BlockRefreshAction';
|
||||
import { SchemaComponentOptions } from '@nocobase/client';
|
||||
import { SchemaComponentOptions, useCurrentPopupContext, useLocalVariables } from '@nocobase/client';
|
||||
import { GlobalAutoRefreshProvider } from './GlobalAutoRefreshProvider';
|
||||
import _ from 'lodash';
|
||||
|
||||
export const ChartBlockProvider: React.FC = (props) => {
|
||||
const currentPopupContext = useCurrentPopupContext();
|
||||
const localVariables = useLocalVariables();
|
||||
const popUpCtxReady =
|
||||
_.isEmpty(currentPopupContext) ||
|
||||
localVariables?.some((variable) => variable.name === '$nPopupRecord' && variable.ctx);
|
||||
|
||||
if (!popUpCtxReady) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<SchemaComponentOptions
|
||||
components={{
|
||||
BlockRefreshButton,
|
||||
}}
|
||||
>
|
||||
<GlobalAutoRefreshProvider> {props.children}</GlobalAutoRefreshProvider>
|
||||
<GlobalAutoRefreshProvider>{props.children}</GlobalAutoRefreshProvider>
|
||||
</SchemaComponentOptions>
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user