[8.8] [Synthetics] Do page refresh when auto refresh toggle is turned on (#156816) (#156890)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Synthetics] Do page refresh when auto refresh toggle is turned on
(#156816)](https://github.com/elastic/kibana/pull/156816)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2023-05-05T16:30:12Z","message":"[Synthetics]
Do page refresh when auto refresh toggle is turned on
(#156816)\n\nCo-authored-by: Dominique Clarke
<dominique.clarke@elastic.co>","sha":"ef26f0bd94bb48e5703b3cf1472978ac43939856","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:uptime","release_note:skip","v8.8.0","v8.9.0"],"number":156816,"url":"https://github.com/elastic/kibana/pull/156816","mergeCommit":{"message":"[Synthetics]
Do page refresh when auto refresh toggle is turned on
(#156816)\n\nCo-authored-by: Dominique Clarke
<dominique.clarke@elastic.co>","sha":"ef26f0bd94bb48e5703b3cf1472978ac43939856"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/156816","number":156816,"mergeCommit":{"message":"[Synthetics]
Do page refresh when auto refresh toggle is turned on
(#156816)\n\nCo-authored-by: Dominique Clarke
<dominique.clarke@elastic.co>","sha":"ef26f0bd94bb48e5703b3cf1472978ac43939856"}}]}]
BACKPORT-->

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
This commit is contained in:
Kibana Machine 2023-05-05 13:34:39 -04:00 committed by GitHub
parent 8e6af8b489
commit 715b857252
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,6 +36,12 @@ export const SyntheticsRefreshContextProvider: React.FC = ({ children }) => {
setLastRefresh(refreshTime);
}, [setLastRefresh]);
useEffect(() => {
if (!refreshPaused) {
refreshApp();
}
}, [refreshApp, refreshPaused]);
const value = useMemo(() => {
return {
lastRefresh,