-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
) # Backport This will backport the following commits from `main` to `8.15`: - [[Synthetics] Measure overview page performance (#191703)](#191703) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-08-29T15:36:37Z","message":"[Synthetics] Measure overview page performance (#191703)\n\n## Summary\r\n\r\nMeasure overview page performance !!\r\n\r\nalso introduced the usePageReady hook in ebt-tooling !!\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"b9072e31ecc56ebaf2bb8df6b576bba7501043ab","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-management","v8.16.0"],"number":191703,"url":"https://github.com/elastic/kibana/pull/191703","mergeCommit":{"message":"[Synthetics] Measure overview page performance (#191703)\n\n## Summary\r\n\r\nMeasure overview page performance !!\r\n\r\nalso introduced the usePageReady hook in ebt-tooling !!\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"b9072e31ecc56ebaf2bb8df6b576bba7501043ab"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/191703","number":191703,"mergeCommit":{"message":"[Synthetics] Measure overview page performance (#191703)\n\n## Summary\r\n\r\nMeasure overview page performance !!\r\n\r\nalso introduced the usePageReady hook in ebt-tooling !!\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"b9072e31ecc56ebaf2bb8df6b576bba7501043ab"}}]}] BACKPORT-->
- Loading branch information
Showing
5 changed files
with
47 additions
and
15 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
packages/kbn-ebt-tools/src/performance_metrics/context/use_page_ready.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { useEffect, useState } from 'react'; | ||
import { usePerformanceContext } from '../../..'; | ||
|
||
export const usePageReady = (state: { isReady: boolean }) => { | ||
const { onPageReady } = usePerformanceContext(); | ||
|
||
const [isReported, setIsReported] = useState(false); | ||
|
||
useEffect(() => { | ||
if (state.isReady && !isReported) { | ||
onPageReady(); | ||
setIsReported(true); | ||
} | ||
}, [isReported, onPageReady, state.isReady]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters