Skip to content

Commit

Permalink
update root component to only load App when plugin div is present
Browse files Browse the repository at this point in the history
this prevents the plugin from doing any background loading whilst SG maintenance mode is active
  • Loading branch information
louise-davies committed Oct 13, 2023
1 parent 7c81500 commit 8253583
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/datagateway-dataview/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function domElementGetter(): HTMLElement {
const reactLifecycles = singleSpaReact({
React,
ReactDOM,
rootComponent: App,
rootComponent: () => (document.getElementById(pluginName) ? <App /> : null),
domElementGetter,
});

Expand Down
3 changes: 2 additions & 1 deletion packages/datagateway-download/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ function domElementGetter(): HTMLElement {
const reactLifecycles = singleSpaReact({
React,
ReactDOM,
rootComponent: App,
rootComponent: () =>
document.getElementById('datagateway-download') ? <App /> : null,
domElementGetter,
errorBoundary(error) {
log.error(`datagateway-download failed with error: ${error}`);
Expand Down
2 changes: 1 addition & 1 deletion packages/datagateway-search/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function domElementGetter(): HTMLElement {
const reactLifecycles = singleSpaReact({
React,
ReactDOM,
rootComponent: App,
rootComponent: () => (document.getElementById(pluginName) ? <App /> : null),
domElementGetter,
});

Expand Down

0 comments on commit 8253583

Please sign in to comment.