Skip to content
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] Query editor state sync fixes #8803

Merged

Conversation

ashwin-pc
Copy link
Member

@ashwin-pc ashwin-pc commented Nov 4, 2024

Description

The Query editor and similarly auto complete use the query state to corretcly query the Datasource. However the query state value used by different parts of the editor UI are out of sync. This PR clearly demarcates which instance of the query you are using and calls out why that is the rught query object to reference.

It also addresses a quirk of monaco which after initialization does not use the latest value of the query object resulting in incorrect values being used for language and dataset. This is fixed by using useRef to store a referenc of the object that the monaco callback can use when the shortcut commands are fired.

Issues Resolved

  1. When the user is using the single line editor, they type a word and hit enter, the query clears the current value. Ths is because the monaco callback onEnter did not use the vlue from the editor. Fixed by using the editor value directly
  2. When the page is loaded and the query states are changed e.g. langauge is changed. When Cmd+Enter is hit, the language and datasource revert back to the default values when the app was loaded. Thsi is fixed using the ref hack

Screenshot

Testing the changes

Changelog

  • fix: Query Editor state sync issues in Discover

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link
Contributor

github-actions bot commented Nov 4, 2024

❌ Empty Changelog Section

The 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.

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.77%. Comparing base (5829303) to head (b896869).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8803   +/-   ##
=======================================
  Coverage   60.77%   60.77%           
=======================================
  Files        3798     3798           
  Lines       90695    90695           
  Branches    14279    14279           
=======================================
  Hits        55121    55121           
  Misses      32075    32075           
  Partials     3499     3499           
Flag Coverage Δ
Linux_1 29.05% <ø> (ø)
Linux_2 56.39% <ø> (ø)
Linux_3 37.64% <ø> (ø)
Linux_4 29.82% <ø> (ø)
Windows_1 29.07% <ø> (ø)
Windows_2 56.34% <ø> (ø)
Windows_3 37.64% <ø> (+<0.01%) ⬆️
Windows_4 29.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

kavilla
kavilla previously approved these changes Nov 4, 2024
Co-authored-by: Kawika Avilla <[email protected]>
Signed-off-by: Ashwin P Chandran <[email protected]>
@SuZhou-Joe SuZhou-Joe merged commit 358d823 into opensearch-project:main Nov 4, 2024
68 of 69 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 4, 2024
* mosty working

* fix reference issue

* Changeset file for PR #8803 created/updated

* Apply suggestions from code review

Co-authored-by: Kawika Avilla <[email protected]>
Signed-off-by: Ashwin P Chandran <[email protected]>

---------

Signed-off-by: Ashwin P Chandran <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: Kawika Avilla <[email protected]>
(cherry picked from commit 358d823)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
abbyhu2000 pushed a commit that referenced this pull request Nov 12, 2024
* mosty working

* fix reference issue

* Changeset file for PR #8803 created/updated

* Apply suggestions from code review




---------




(cherry picked from commit 358d823)

Signed-off-by: Ashwin P Chandran <[email protected]>
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>
Co-authored-by: Kawika Avilla <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants