-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[discover] fix too many queries sent #8347
[discover] fix too many queries sent #8347
Conversation
the dependency array was triggering updates and re-calls. forcing a re-render of elements that had the possibility of updating the query manager. Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
❌ Empty Changelog SectionThe Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8347 +/- ##
==========================================
- Coverage 60.98% 60.92% -0.07%
==========================================
Files 3743 3748 +5
Lines 88857 89016 +159
Branches 13859 13898 +39
==========================================
+ Hits 54188 54229 +41
- Misses 31314 31424 +110
- Partials 3355 3363 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing
useEffect(() => { | ||
const subscription = queryString.getUpdates$().subscribe((query) => { | ||
setSelectedDataset(query.dataset); | ||
}); | ||
|
||
return () => subscription.unsubscribe(); | ||
}, [queryString]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember being confused why this is here. Was there a reason why we needed two places to set the selected dataset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not positive. probably was just code that was intended to be cleaned up i think i at one point we would set the query at the configurator level instead of using the function that we passed in to set it and then when we got time to wire up and use the passed in function it caused some issue with re-rendering.
@@ -68,6 +68,7 @@ export class QueryStringManager { | |||
const query = { | |||
query: defaultQuery, | |||
language: defaultLanguageId, | |||
dataset: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary? i see query is used to construct newQuery
and dataset is set to be defaultDataset in line 81
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my linter was complaining because i thought the return type was just query language but it's causing a test failure so im just gunna revert this and but a linter ignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, lgtm
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
…OpenSearch-Dashboards-1 into kavilla/discovermultiplequeries
3352f97
failures unrelated and i think another PR is fixing it. |
Fixes the issue where too many queries were being fired. A number of things were being called because the dependency array was triggering updates and re-calls. Forcing a re-render of elements that had the possibility of updating the query manager. Includes some tests. Signed-off-by: Kawika Avilla <kavilla414@gmail.com> --------- Signed-off-by: Kawika Avilla <kavilla414@gmail.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 0882435) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Fixes the issue where too many queries were being fired. A number of things were being called because the dependency array was triggering updates and re-calls. Forcing a re-render of elements that had the possibility of updating the query manager. Includes some tests. Signed-off-by: Kawika Avilla <kavilla414@gmail.com> --------- Signed-off-by: Kawika Avilla <kavilla414@gmail.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Fixes the issue where too many queries were being fired. A number of things were being called because the dependency array was triggering updates and re-calls. Forcing a re-render of elements that had the possibility of updating the query manager. Includes some tests. --------- (cherry picked from commit 0882435) Signed-off-by: Kawika Avilla <kavilla414@gmail.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
…earch-project#8361) Fixes the issue where too many queries were being fired. A number of things were being called because the dependency array was triggering updates and re-calls. Forcing a re-render of elements that had the possibility of updating the query manager. Includes some tests. --------- (cherry picked from commit 0882435) Signed-off-by: Kawika Avilla <kavilla414@gmail.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Description
Fixes the issue where too many queries were being fired. A number of things were being called because the dependency array was triggering updates and re-calls. Forcing a re-render of elements that had the possibility of updating the query manager.
Includes some tests.
Issues Resolved
n/a
Screenshot
Testing the changes
locally and tests
Changelog
Check List
yarn test:jest
yarn test:jest_integration