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: Append, replace, removeOne, & removeAll operations for SetValue #2914

Merged
merged 17 commits into from
May 23, 2024

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Mar 21, 2024

What does this PR do?

  • Changes SetValue component from having a single operation, to having an option to append, replace, removeOne or removeAll

Testing

Basic test flow here - https://2914.planx.pizza/testing/set-value-playground

This (hopefully!) illustrates that the behaviour matches the desired outcomes discussion at our recent "Logic Camp" - full details here - https://miro.com/app/board/uXjVN9K07PQ=/?moveToWidget=3458764588027715730&cot=14

I feel like there's a decent level of unit testing here, as well as more psuedo-integration level tests calling store functions to mock a user's journey.

What I'm really interested in testing feedback on would be -

  • Unexpected, or breaking, changes in existing flows - possibly related to edge cases with current SetValue
  • Is there something missing in how multiple SetValue components interact with each other?
  • Anything that could break this!

Next steps...

  • Illustrative examples in Editor modar, similar to how Calculate shows examples to the user
image

Copy link

github-actions bot commented Mar 21, 2024

Removed vultr server and associated DNS entries

@DafyddLlyr DafyddLlyr requested a review from a team March 21, 2024 14:35
@DafyddLlyr DafyddLlyr marked this pull request as ready for review March 21, 2024 14:37
Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

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

V exciting 🎉 a couple questions after a quick first pass!

editor.planx.uk/src/@planx/components/SetValue/Editor.tsx Outdated Show resolved Hide resolved
editor.planx.uk/src/pages/FlowEditor/lib/store/preview.ts Outdated Show resolved Hide resolved
@DafyddLlyr DafyddLlyr changed the title feat(wip): Append, replace, or remove operations for SetValue feat: Append, replace, or remove operations for SetValue Mar 25, 2024
@DafyddLlyr DafyddLlyr force-pushed the dp/set-value-v2 branch 2 times, most recently from 5e1ae08 to 3d0c6e2 Compare May 2, 2024 16:02
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file should represent the inputs/outputs described in this "Logic Camp" diagram -

image

Source: https://miro.com/app/board/uXjVN9K07PQ=/?moveToWidget=3458764578921902831&cot=14

@DafyddLlyr DafyddLlyr changed the title feat: Append, replace, or remove operations for SetValue feat: Append, replace, removeOne, & removeAll operations for SetValue May 3, 2024
* Handle modifying passport values when passing through a SetValue component
* Called by computePassport()
*/
export const handleSetValue: HandleSetValue = ({
Copy link
Contributor Author

@DafyddLlyr DafyddLlyr May 6, 2024

Choose a reason for hiding this comment

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

Following previous conversations, I've refactored this logic to be co-located with the component rather than being purely within the store.

The motivations here were two-fold -

  • This is SetValue logic and doesn't relate to any other components - it just can't get called by this component directly
  • We actually want to use some of this code within the Editor modal to show the Editor examples of how this component works (upcoming PR). Locating this within the store would make this harder to re-use in a different context.

Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

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

Sorry it's taken me a minute to get back to this one. Most recent changes all look good here - any final testing/coordination needed with Content team before merging? Let's aim to get this out in the wild this week!

@DafyddLlyr DafyddLlyr merged commit 944df89 into main May 23, 2024
12 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/set-value-v2 branch May 23, 2024 08:56
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.

3 participants