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

[ResourceList] refactor to functional component #2843

Merged
merged 17 commits into from
Jun 8, 2020

Conversation

athornburg
Copy link
Contributor

@athornburg athornburg commented Mar 14, 2020

WHY are these changes introduced?

In order to make the render item function infer the item's type we refactored to a functional component and made ResourceList generic.

Fixes #543

WHAT is this pull request doing?

More info in the discussion here.
ResourceList will also be a functional component as part of #1995
+ use the 18n hook for internationalization
+ made item generic
+ made the item render functions use the items type

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

ResourceList is in the storybook already.

🎩 checklist

  • Tested on mobile
  • Tested on multiple browsers
  • Tested for accessibility
  • Updated the component's README.md with documentation changes
  • Tophatted documentation changes in the style guide
  • For visual design changes, pinged one of @ HYPD, @ mirualves, @ sarahill, or @ ry5n to update the Polaris UI kit

@ghost
Copy link

ghost commented Mar 14, 2020

👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines.

@athornburg
Copy link
Contributor Author

athornburg commented Mar 14, 2020

I also have some ideas about good patterns and further refactorings. There are now some opportunities for separations of concerns around checkboxes, list views etc that could really clean-up this component. I wanted to get a PR in because the change was starting to get big. Excited to talk more about this on Monday. Also, the test coverage was great. Kudos to you all.

@athornburg athornburg force-pushed the resource-list-to-functional branch 2 times, most recently from 0dafcdb to cf1f6b0 Compare March 14, 2020 20:48
@athornburg athornburg changed the title Refactor resource list to a functional component [ResourceList] refactor to a functional component Mar 16, 2020
@athornburg athornburg changed the title [ResourceList] refactor to a functional component [ResourceList] refactor to functional component Mar 16, 2020
Copy link
Member

@BPScott BPScott left a comment

Choose a reason for hiding this comment

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

A quick first pass

src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
@athornburg
Copy link
Contributor Author

@BPScott thanks for the feedback. Ill have a look.

@ghost ghost added the cla-needed Added by a bot. Contributor needs to sign the CLA Agreement. label Mar 17, 2020
@athornburg athornburg force-pushed the resource-list-to-functional branch 2 times, most recently from 5961e40 to cb08355 Compare March 18, 2020 01:42
@ghost ghost removed the cla-needed Added by a bot. Contributor needs to sign the CLA Agreement. label Mar 18, 2020
@athornburg
Copy link
Contributor Author

@BPScott, anymore feedback on this? I'm happy to revise it more.

Copy link
Member

@BPScott BPScott left a comment

Choose a reason for hiding this comment

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

Thanks for your patience, this past fortnight has been pretty hectic.

A few more comments inline with some ideas on how you can simplify some default values. I haven't tested the functional behaviour yet as I'm not familiar ResourceList's inner workings though. @AndrewMusgrave, would you have the time to take over the review of this PR, check if it's working from a functional perspective and get it merged?

src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
@athornburg
Copy link
Contributor Author

Hey @BPScott, thanks for getting back to me. Hope you're staying safe. I'll have a look at your comments sometime tomorrow. I can help do some functional testing as well if it helps.

@athornburg athornburg force-pushed the resource-list-to-functional branch from 1aa5f9d to bb55c51 Compare April 9, 2020 14:38
@athornburg
Copy link
Contributor Author

@BPScott I think I have incorporated all your feedback. Would be happy to continue revising or start some manual testing with @AndrewMusgrave. Let me know if there is more I can do to help.

@AndrewMusgrave
Copy link
Member

Hey @athornburg , sorry about the wait! Hoping to review this in the next couple days 😄

Copy link
Contributor

@dleroux dleroux left a comment

Choose a reason for hiding this comment

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

I have a meeting to run to, I will continue reviewing later.

Thanks for doing this @athornburg !

.gitignore Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
UNRELEASED.md Outdated Show resolved Hide resolved
src/components/ResourceList/ResourceList.tsx Outdated Show resolved Hide resolved
@athornburg
Copy link
Contributor Author

Thanks for more feedback @dleroux and @AndrewMusgrave. I'll have a look at this during my lunch break. Happy to help.

@athornburg athornburg force-pushed the resource-list-to-functional branch from 2c26911 to 600c5d2 Compare April 15, 2020 17:57
locales/en.json Outdated Show resolved Hide resolved
locales/en.json Outdated Show resolved Hide resolved
locales/en.json Outdated Show resolved Hide resolved
locales/en.json Outdated Show resolved Hide resolved
locales/en.json Outdated Show resolved Hide resolved
locales/en.json Outdated Show resolved Hide resolved
locales/en.json Outdated Show resolved Hide resolved
@athornburg athornburg force-pushed the resource-list-to-functional branch from 86f1747 to 2128b64 Compare June 5, 2020 22:27
Copy link
Contributor

@amrocha amrocha left a comment

Choose a reason for hiding this comment

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

LGTM!

@AndrewMusgrave
Copy link
Member

@dleroux When you have a chance it would be great if you can take a look at the sticky header stuff and give a review 😄

@dleroux dleroux self-requested a review June 8, 2020 19:11
Copy link
Contributor

@dleroux dleroux left a comment

Choose a reason for hiding this comment

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

@athornburg Thank you so much for doing this an following through! Amazing 🥇 🎉

I top-hatted and works perfectly. 🚢

@athornburg
Copy link
Contributor Author

athornburg commented Jun 8, 2020

Awesome! Thank you all for the feedback and working with me on this. I had a lot of fun! Hope you all are staying safe and healthy. Let me know if I can help in any other way.

@amrocha
Copy link
Contributor

amrocha commented Jun 8, 2020

I think CI is gonna get stuck since this is an outside contribution. Let me see if there's a way around it, and if not one of us will merge it for you tomorrow morning

@amrocha
Copy link
Contributor

amrocha commented Jun 8, 2020

Yep, CI is stuck because we only run certain jobs for Travis branch builds, but since this is a PR with no local branch it only ran the PR build.

It's nbd, I'm gonna merge this and make an issue to figure out external CI stuff

@amrocha amrocha merged commit 9ae74bc into Shopify:master Jun 8, 2020
@ghost
Copy link

ghost commented Jun 8, 2020

🎉 Thanks for your contribution to Polaris React!

@kyledurand
Copy link
Member

Just seeing this now and have to say amazing everyone! Thanks so much @athornburg! 🎉

@alex-page
Copy link
Member

Thank you so much @athornburg

@BPScott
Copy link
Member

BPScott commented Jun 9, 2020

Fantastic work! Big thanks to @athornburg for persevering with us and to the Polaris folks for helping get this over the line

@athornburg
Copy link
Contributor Author

No problem! I had a lot of fun working with you all on this. Thanks for all the help, feedback and time.

@athornburg athornburg deleted the resource-list-to-functional branch June 9, 2020 23:52
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.

Allow generic type argument for ResourceList items
7 participants