PanelRenderer: fix error when variable replacement is used (#60968)

fix panel renderer when using replace
This commit is contained in:
Domas 2023-01-04 16:20:44 +02:00 committed by GitHub
parent 4ae0382415
commit 72d257ed4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,7 +33,8 @@ export function PanelRenderer<P extends object = any, F extends object = any>(pr
} = props;
const theme = useTheme2();
const replace = useMemo(() => getTemplateSrv().replace, []);
const templateSrv = getTemplateSrv();
const replace = useMemo(() => templateSrv.replace.bind(templateSrv), [templateSrv]);
const [plugin, setPlugin] = useState(syncGetPanelPlugin(pluginId));
const [error, setError] = useState<string | undefined>();
const optionsWithDefaults = useOptionDefaults(plugin, options, fieldConfig);