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: Basic CRUD for userData structure, setup ListContext #3198

Merged
merged 3 commits into from
May 28, 2024

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented May 27, 2024

What does this PR do?

Screen.Recording.2024-05-28.at.13.03.39.mov

What's not in this PR?

  • No form state / form validation - any values typed into inputs is not persisted
  • Logic to stop new items being added when there's still an active/incomplete item
  • UI polish, e.g. scroll to new item, scrol on delete or edit

Context / Design

I feel like one of the main pain points with the FileUploadAndLabel component was having a group of interdependent components which relied on a shared state in the "root" component. This wasn't a problem initially, but as things grew it got harder and harder to manage, and there's a lot of prop-drilling and derived state there. I've tried to anticipate this a little by setting up a React.Context to wrap these components. This also means co-location of logic, and separation from style/structure which is nice.

Again, a lot of unfinished work and outstanding TODOs in this PR!

Copy link

github-actions bot commented May 27, 2024

Removed vultr server and associated DNS entries

@DafyddLlyr DafyddLlyr force-pushed the dp/list-user-data branch 3 times, most recently from 421bf70 to a3a6021 Compare May 28, 2024 11:43
schema,
}) => {
const [activeIndex, setActiveIndex] = useState<number | undefined>(0);
const [userData, setUserData] = useState<UserData>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm still not 100% sure how this will interact with a Fromik instance, so this may get updated in the next PR to either be just be Fromik state, or this can be generated by Formik.

I've intentionally avoided this in the current PR to keep thing separate and as small as possible, even if it may mean a little more "churn".

@DafyddLlyr DafyddLlyr requested a review from a team May 28, 2024 12:06
@DafyddLlyr DafyddLlyr marked this pull request as ready for review May 28, 2024 12:06
Base automatically changed from dp/list-component-basic-types to main May 28, 2024 13:43
@DafyddLlyr DafyddLlyr force-pushed the dp/list-user-data branch from a3a6021 to 8024a3f Compare May 28, 2024 13:48
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.

Went through this one fairly quickly, appreciate these are iterative & feature-flagged.

Thanks for super descriptive tests, looking good !

// Button is present allow additional items to be added
const addItemButton = getByRole("button", {
name: /Add a new animal type/,
});
Copy link
Member

Choose a reason for hiding this comment

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

nit: introducing & using a stable data-testid attribute for the addItemButton & similar early might mean less tedious updates based on "name" later and more generic tests independent of schemas?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a great shout actually - will make that change 👍

Copy link
Contributor

@RODO94 RODO94 May 28, 2024

Choose a reason for hiding this comment

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

question: @jessicamcinchak what does "nit" mean?

Copy link
Member

Choose a reason for hiding this comment

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

shorthand for "nit picky" ! opinionated minor suggestions basically, almost always non-blocking to overall approval and readiness to merge 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RODO94 We talked about conventional commits for PR names as part of onboarding. Using nit/nitpick comes from conventional comments which we use here and there also 👍

}}
>
{children}
</ListContext.Provider>
Copy link
Member

Choose a reason for hiding this comment

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

👍

@DafyddLlyr DafyddLlyr merged commit 80d420d into main May 28, 2024
12 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/list-user-data branch May 28, 2024 15:18
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