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

fix: sandbox not render another queries #349

Merged
merged 3 commits into from
Sep 20, 2022

Conversation

brenocota-hotmart
Copy link
Contributor

What:
As mentioned in this issue, when we have a list, the tool does not show us other possible query options.

Example:
image

Why:
To improve the developer experience, the following function was added, basically we check if there is any valid query, if there is none, it works with the previous implementation.

function checkQuery(queries) {
  const suggestions = Object.values(queries).filter(Boolean);
  const suggestion = Object.values(queries).find(Boolean);
  
  const anotherSuggestion = suggestions.find(
    (query) =>
      query?.queryName && !query.snippet?.startsWith('// sorry, I failed'),
  );

  return anotherSuggestion ? anotherSuggestion : suggestion;
}

Print screen:
image

As it maintains the order of the elements, the best query will be used

How:
Implementation is complete and tests continue to pass

Checklist:

  • Tests
  • Ready to be merged

@brenocota-hotmart
Copy link
Contributor Author

Hi, @smeijer how are you? You could review this PR?

@smeijer
Copy link
Member

smeijer commented Sep 20, 2022

Thanks! Looks good to me. We can merge as soon as the tests finish.

@smeijer smeijer merged commit d85b47a into testing-library:develop Sep 20, 2022
smeijer added a commit that referenced this pull request Sep 20, 2022
* fix: sandbox not render another queries
smeijer added a commit that referenced this pull request Mar 2, 2023
* fix: sandbox not render another queries (#349)

* fix: sandbox not render another queries

* fixup! fix: sandbox not render another queries

* re-trigger github workflow

Co-authored-by: Breno Cota <[email protected]>

* chore: remove broken link to Firefox Extension (#359)

* chore: remove link to a closed roadmap (#354)

Co-authored-by: Luís Soares <[email protected]>

* chore: remove roadmap link from specs (#361)

---------

Co-authored-by: Breno Cota <[email protected]>
Co-authored-by: Breno Cota <[email protected]>
Co-authored-by: lx4r <[email protected]>
Co-authored-by: Luís Soares <[email protected]>
Co-authored-by: Luís Soares <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants