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

Select the correct language when a different one is chosen by the dataset selector #8671

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AMoo-Miki
Copy link
Collaborator

Description

Select the correct language when a different one is chosen by the dataset selector

Changelog

  • fix: Select the correct language when a different one is chosen by the dataset selector

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

…aset selector

Authored-by: Suchit Sahoo <suchsah@amazon.com>
Signed-off-by: Miki <miki@amazon.com>
Copy link

codecov bot commented Oct 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.85%. Comparing base (7da5443) to head (5be475d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8671   +/-   ##
=======================================
  Coverage   60.85%   60.85%           
=======================================
  Files        3793     3793           
  Lines       90368    90368           
  Branches    14181    14181           
=======================================
  Hits        54997    54997           
- Misses      31893    31894    +1     
+ Partials     3478     3477    -1     
Flag Coverage Δ
Linux_1 29.09% <0.00%> (ø)
Linux_2 56.39% <ø> (ø)
Linux_3 37.68% <100.00%> (+<0.01%) ⬆️
Linux_4 29.82% <0.00%> (-0.01%) ⬇️
Windows_1 29.11% <0.00%> (ø)
Windows_2 56.34% <ø> (ø)
Windows_3 37.68% <100.00%> (ø)
Windows_4 29.82% <0.00%> (ø)

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.

const newQuery = this.queryString.getInitialQuery();
const newQueryString = newQuery.query;
if (this.inputRef.getValue() !== newQueryString) {
const newQueryString = this.props.query.query;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think now when i select the dataset for the new language the query string is not updated with the updated dataset.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recreation steps:

  • have an index pattern and navigate to discover. load results
  • select an index from a cluster.
  • notice how the query (if for sql and ppl) still references the old dataset

@@ -44,7 +44,7 @@ export const QueryLanguageSelector = (props: QueryLanguageSelectorProps) => {
: undefined;

useEffect(() => {
const subscription = queryString.getUpdates$().subscribe((query: Query) => {
const subscription = queryString.getUpdates$(0).subscribe((query: Query) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it potentially just a race condition or something?

could we verify if the props.query.language is the current query always. and this component gets re-rendered. i need to verify since last checking these things out. or if you have the insight already.

because what im thinking is that potentially the dataset is checking which languages are supported and adding to a list while this is listening to changes and before the language is added this setter is called but set to the first language it found.

there's a couple of places i think were we need loading spinners. shooting in the dark perhaps we just need to check if everything is done loading before setting the current language?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or opt for just disabling unsupported languages and setting the current value vs removing them from view

@ashwin-pc ashwin-pc marked this pull request as draft October 23, 2024 14:59
@ashwin-pc
Copy link
Member

Marking as draft because we have another fix. Will close once Miki confirms that there is nothing in this PR thats needs to be picked up

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