Skip to content

Commit f836225

Browse files
Update external resources usage (#384)
* update externalResources * Update CHANGELOG.md --------- Co-authored-by: Mikhail Volkov <[email protected]>
1 parent e437cf2 commit f836225

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Features / Enhancements
66

77
- Added context.grafana.refresh (#387)
8+
- Updated external resources usage (#384)
89

910
## 5.6.0 (2024-12-15)
1011

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/TextPanel/TextPanel.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,18 @@ export const TextPanel: React.FC<Props> = ({
8585
[data.series, frameIndex, options.renderMode]
8686
);
8787

88+
/**
89+
* External Resources; use memo to prevent endless call to resources
90+
*/
91+
const externalResources = useMemo(() => {
92+
return options.externalStyles.map((resource) => ({ ...resource, url: replaceVariables(resource.url) }));
93+
}, [options.externalStyles, replaceVariables]);
94+
8895
/**
8996
* External Styles
9097
*/
9198
useExternalResources({
92-
items: options.externalStyles.map((resource) => ({ ...resource, url: replaceVariables(resource.url) })),
99+
items: externalResources,
93100
type: ResourceType.STYLES,
94101
});
95102

0 commit comments

Comments
 (0)