[Security Solution] Loading fallback poc for data views#225111
Closed
lgestc wants to merge 7 commits intoelastic:mainfrom
Closed
[Security Solution] Loading fallback poc for data views#225111lgestc wants to merge 7 commits intoelastic:mainfrom
lgestc wants to merge 7 commits intoelastic:mainfrom
Conversation
Contributor
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
lgestc
commented
Jun 25, 2025
| const { dataView } = useDataView(DataViewManagerScopeName.default); | ||
| // NOTE: there should be a Suspense / some kind of loader here as this value is not settled immediately | ||
| const experimentalIndicesExist = !!dataView?.matchedIndices?.length; | ||
| const dataView = useDataView(DataViewManagerScopeName.default, true); |
Contributor
Author
There was a problem hiding this comment.
true triggers the "synchronous" behaviour
lgestc
commented
Jun 25, 2025
| fallback = fallbackElement, | ||
| }) => { | ||
| // eslint-disable-next-line react-hooks/rules-of-hooks | ||
| const results = scopes.map((scope) => useDataView(scope, false)); |
Contributor
Author
There was a problem hiding this comment.
In sync mode, data views will be fetched on top level (restored from data view service cache), and then reused in useDataView when it is called with isSync = true
|
|
||
| return ( | ||
| <DataViewContext.Provider value={value}> | ||
| {allReady ? children : fallback} |
Contributor
Author
There was a problem hiding this comment.
Render a fallback until data views are loaded
lgestc
commented
Jun 25, 2025
| scope: DataViewManagerScopeName; | ||
| } | ||
|
|
||
| type ConditionalReturn<IsSync extends boolean> = IsSync extends true |
Contributor
Author
There was a problem hiding this comment.
depending on the flag value, we are getting different return types
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a POC to test an approach to loading data view information in components.
Adding
isSyncflag touseDataViewhook, allowing us to remove all the checks for loading state / undefined values in components that consume data views.