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

feat: Filters support choosing any flagset category #3797

Merged
merged 7 commits into from
Oct 11, 2024

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Oct 10, 2024

Changes:

  • Filter component supports picking from any available flagset categories & renders it correctly on the graph
    • It defaults to the "Planning permission" category so existing components should work without needing an "Update"
    • Uses same bare bones <select /> styling as External Portal and Result modals, let's revisit styles later
  • I have NOT touched the collectedFlags store method here, which means that all non-"Planning permission" filters won't actually "work" yet - in that they aren't correctly reading collected flags and still exclusively route down the "No flag result" branch

Screenshot from 2024-10-10 13-43-02

Screenshot from 2024-10-10 13-32-27

Copy link

github-actions bot commented Oct 10, 2024

Removed vultr server and associated DNS entries

name="category"
value={formik.values.category}
onChange={formik.handleChange}
>
Copy link
Member Author

Choose a reason for hiding this comment

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

My current thinking is that we can merge this to main with a simple disabled prop added here?

Then I can rebase into #3764, correctly adjust filter automations, and un-disable? Does this sound solid, anything I might be forgetting?

Please test flows on this pizza with existing filter components to confirm they work correctly before any type of node "Update" !

@jessicamcinchak jessicamcinchak marked this pull request as ready for review October 11, 2024 07:36
@jessicamcinchak jessicamcinchak requested a review from a team October 11, 2024 07:36
id?: string;
handleSubmit?: (d: any, children: any) => void;
node?: any;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This was unused! Removed to avoid confusion, we're simply reading props defined at the top of Editor.tsx.

);

fireEvent.change(screen.getByTestId("flagset-category-select"), {
target: { value: "Community infrastructure levy" },
Copy link
Contributor

Choose a reason for hiding this comment

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

question: why would we use fireEvent here rather than userEvent?

Does it make selecting from a <select> easier?
(rather than going through user.click, find the options, user.click again...)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using fireEvent throughout this file because the modal submit buttons like "Create filter" / "Update filter" aren't easily accessible to user.click() - therefore fireEvent.submit() is handy to have (this is commonly used throughout other "Editor" test files as well).

I think the select interaction specifically could be migrated to userEvent going forward - which would mean we'd be testing the interaction more realistically to how the user would experience it in the browser.

value={formik.values.category}
onChange={formik.handleChange}
>
{Array.from(categories).map((category) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

First time seeing this, its so slick with the new Set() above!

Copy link
Contributor

@RODO94 RODO94 left a comment

Choose a reason for hiding this comment

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

I ran through a prior approval check and from my understanding I ended up where I expected with the existing filters in place. Although it would be nice to have a session on this, I'll put something in Slack

Only one comment on the Editor Modal and one on using fireEvent in the tests. Both are nits and don't require action, more feedback on my expectations.

Rebasing on to the other PR mentioned sounded right and I couldn't think of anything missed here

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'd expect the Editor model to be similar to the Result component, where I can see the filter options before updating. I am an uneducated user, so it is feasible that this is redundant for people who know what to expect from the filters.

Copy link
Member Author

Choose a reason for hiding this comment

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

Filter options are not editable, they are hard-coded only still - therefore in my opinion there's no reason to display them in the modal here (they'd have to be disabled fields?).

In the future, when we may have customisable filter options (aka flags and flagsets), then I imagine it will make sense to expose them directly here rather select from a pre-existing/pre-configured category ! But that's out of scope of these changes.

@jessicamcinchak jessicamcinchak merged commit ca78e83 into main Oct 11, 2024
12 checks passed
@jessicamcinchak jessicamcinchak deleted the jess/filters-select-flagset branch October 11, 2024 10:46
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