Skip to content

Commit

Permalink
Fix cloud plugin install not refreshing (#2932)
Browse files Browse the repository at this point in the history
# What this PR does

## Which issue(s) this PR fixes

#2874

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
  • Loading branch information
teodosii authored Sep 1, 2023
1 parent 5c189c8 commit 88c5338
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Fixed

- Fix for Cloud plugin install not refreshing page after completion ([2974](https://github.com/grafana/oncall/issues/2874))

## v1.3.30 (2023-08-31)

### Added
Expand All @@ -25,8 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix issue with helm chart when specifying `broker.type=rabbitmq` where Redis environment variables
were not longer being injected by @joeyorlando ([#2927](https://github.com/grafana/oncall/pull/2927))
- Fix silence for alert groups with empty escalation chain @Ferril ([#2929](https://github.com/grafana/oncall/pull/2929))
- Fixed NPE when migrating legacy Grafana Alerting integrations
([#2908](https://github.com/grafana/oncall/issues/2908))
- Fixed NPE when migrating legacy Grafana Alerting integrations ([#2908](https://github.com/grafana/oncall/issues/2908))
- Fix `IntegrityError` exceptions that occasionally would occur when trying to create `ResolutionNoteSlackMessage`
objects by @joeyorlando ([#2933](https://github.com/grafana/oncall/pull/2933))

Expand Down
20 changes: 14 additions & 6 deletions grafana-plugin/src/plugin/GrafanaPluginRootPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const Root = observer((props: AppRootProps) => {
const [basicDataLoaded, setBasicDataLoaded] = useState(false);

useEffect(() => {
updateBasicData();
runQueuedUpdateData(0);
}, []);

const location = useLocation();
Expand All @@ -98,11 +98,6 @@ export const Root = observer((props: AppRootProps) => {
};
}, []);

const updateBasicData = async () => {
await store.updateBasicData();
setBasicDataLoaded(true);
};

const page = getMatchedPage(location.pathname);
const pagePermissionAction = pages[page]?.action;
const userHasAccess = pagePermissionAction ? isUserActionAllowed(pagePermissionAction) : true;
Expand Down Expand Up @@ -206,4 +201,17 @@ export const Root = observer((props: AppRootProps) => {
</div>
</DefaultPageLayout>
);

async function runQueuedUpdateData(attemptCount: number) {
if (attemptCount === 10) {
return;
}

try {
await store.updateBasicData();
setBasicDataLoaded(true);
} catch {
setTimeout(() => runQueuedUpdateData(attemptCount + 1), 1000);
}
}
});

0 comments on commit 88c5338

Please sign in to comment.