Skip to content

Data Array Enhancement (followup) #6725

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

Merged
merged 17 commits into from
Apr 17, 2023
Merged

Conversation

JCoder121
Copy link
Contributor

What does this PR do?

follow up from #6704, fixes filtering when filter value is an object with {label: __, value: __}

Where should the reviewer start?

src/js/components/Data/filter.js
src/js/components/Data/stories/Complex.js

What testing has been done on this PR?

manual + visual testing

How should this be manually tested?

ensure that filtering works as intended

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

Screenshots (if appropriate)

Do the grommet docs need to be updated?

Should this PR be mentioned in the release notes?

Is this change backwards compatible or is it a breaking change?

@JCoder121 JCoder121 requested a review from taysea April 3, 2023 17:19
@JCoder121 JCoder121 changed the title Data Array Enhancement Data Array Enhancement (followup) Apr 3, 2023
if (Array.isArray(value)) {
return !filterValue.some((f) =>
typeof f === 'object'
? value.includes(f.value) // from {label: ___, value: ___}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like previous we were doing a "filterValue.includes(value)" pattern and now we're doing "value.includes(filter)" -- can you explain why we made this switch? Was that a bug in the initial implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Connected over call - value.includes(filter) is used in this case because we iterate over filterValue and we use typeof f to determine if each f is in the form of an object {label: ___, value: __}. If so, we want to check whether or not value includes f.value. Previously, there was no check for typeof f, which resulted in incorrect behavior when each value was a {label: __, value: __} object.

@JCoder121 JCoder121 requested a review from taysea April 10, 2023 20:02
Copy link
Collaborator

@taysea taysea left a comment

Choose a reason for hiding this comment

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

Nice work!

@@ -76,7 +85,8 @@ export const Complex = () => (
status="info"
message="Data is in 'beta'. The API surface is subject to change."
/>
<Data data={data} properties={properties} toolbar>
<Data data={data} properties={properties} updateOn="change">
<DataFilters layer />
Copy link
Collaborator

Choose a reason for hiding this comment

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

One follow up, is it necessary to change the storybook layout of can we leave as it was?

Copy link
Contributor Author

@JCoder121 JCoder121 Apr 13, 2023

Choose a reason for hiding this comment

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

image

I realized after I just tried testing the original layout -- in fullscreen interaction, there is extremely minimal scroll space for the Select options, and `DataFilters layer` somewhat solves the problem. I think this might be an issue unrelated to this PR? Edit: removing `updateOn=change` provides more spacing for the user to scroll, but overall the experience is still feels unwieldy

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm fine adjusting this story to the DataFilters layer, but I'd probably recommend we don't add "updateOn=change" in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for clarifying! Will make that final edit.

@JCoder121 JCoder121 requested review from taysea and jcfilben April 14, 2023 16:07
@JCoder121
Copy link
Contributor Author

4/14/23 status:

Final stages of review, waiting upon final review to wrap things up and should be merged today or early on next week.

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

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

Minor comment, otherwise looks good

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

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

Looks good!

@taysea taysea requested a review from ericsoderberghp April 17, 2023 18:22
@ericsoderberghp ericsoderberghp merged commit 8c141d2 into master Apr 17, 2023
@ericsoderberghp ericsoderberghp deleted the DataArrayEnhancement branch April 17, 2023 19:17
@jcfilben jcfilben mentioned this pull request Nov 9, 2022
80 tasks
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.

4 participants