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: add functionality to specify whether a filter that should be initially checked. #240

Closed
wants to merge 1 commit into from

Conversation

jonasbrunvoll
Copy link
Contributor

Closes https://github.com/AtB-AS/kundevendt/issues/16683

Background

NFK have requested that flights are not part of the default transport methods in travel planner web. It should still be possible to enable for the users, but not selected as default.

This is default also in app and at Entur.

  • Uncheck flight as default way of transport in Nordland
  • Uncheck flight FRAM
  • Uncheck train FRAM

Proposed solution

  • If the isUncheckedByDefault property of a filter is defined, set the filter to be initially unchecked.

Copy link

vercel bot commented Feb 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
planner-web ✅ Ready (Inspect) Visit Preview Feb 26, 2024 2:24pm

@@ -54,6 +59,13 @@ function AssistantLayout({ children, tripQuery }: AssistantLayoutProps) {
getTransportModeFilter,
);

useEffect(() => {
tripQuery.transportModeFilter =
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe setValuesWithLoading() should be used here as well? Like we looked at some time ago with some other changes. Or maybe not? I guess if the setValuesWithLoading is used we get an (possibly) unwanted route change.

And it's important to check whether transportModeFilter is set already, then the isUncheckedByDefault should not be taken into account and the filter should remain as is, since there's a chance the user has set the filters themselves. Haven't tested this code, but that might be how this works with the optional chaining and nullish coalescing.

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.

2 participants