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

Hooks #85

Merged
merged 18 commits into from
Feb 29, 2020
Merged

Hooks #85

merged 18 commits into from
Feb 29, 2020

Conversation

BrianMitchL
Copy link
Contributor

@BrianMitchL BrianMitchL commented Feb 16, 2020

Closes #2520704

⚠️ The line above was added during the automatic migration of all github project issues to Kaiten. The old GH issue link is kept here for reference (it is now deprecated, continue follow the original issue on Kaiten).

From the discussion in #83, I refactored the codebase to be built with functional components and hooks. Here's a change log in no particular order:

  • Refactor components to all be functional components
  • Update the peerDependency of react to be ^16.8.0
  • Change the children and customPlaceholder types to be ReactElement instead of ReactNode (this is because the render function in a class Component returns a ReactNode, where functional components return a ReactElement)
  • Remove PropTypes
  • On the ReactPlaceholder component, use a default of 3 for the rows` props.
  • Created more polymorphic TypeScript types for the ReactPlaceholder props
  • Additional tests
  • Upgraded some dependencies
  • Upgrade TypeScript to version 3
  • Enable strict mode with TypeScript

@nemobot nemobot added the WIP label Feb 16, 2020
Copy link
Member

@giogonzo giogonzo left a comment

Choose a reason for hiding this comment

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

Hi @BrianMitchL! Looking good so far, I have left a few preliminary comments. Plus, I'm a bit confused by some of the typings for the top-level component Props - I'll take a second pass soon

src/ReactPlaceholder.tsx Outdated Show resolved Hide resolved
src/ReactPlaceholder.tsx Outdated Show resolved Hide resolved
src/ReactPlaceholder.tsx Outdated Show resolved Hide resolved
type?: undefined;
rows?: undefined;
color?: undefined;
showLoadingAnimation?: undefined;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I get the ?: undefined type for all of these props...

Copy link
Contributor Author

@BrianMitchL BrianMitchL Feb 21, 2020

Choose a reason for hiding this comment

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

Unless we use type guards for these props, this seemed to be the best way to set the values as undefined/not set. Otherwise, we can't even check if they're on the props object, as the compiler will say they don't exist. This pattern is used in the current version of the library. Is there a better way to do this?

Copy link
Member

Choose a reason for hiding this comment

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

I see, I actually missed they were already defined this way in the previous version

src/ReactPlaceholder.tsx Outdated Show resolved Hide resolved
src/ReactPlaceholder.tsx Show resolved Hide resolved
Copy link
Member

@giogonzo giogonzo left a comment

Choose a reason for hiding this comment

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

@BrianMitchL LGTM 👏

Are there any other changes you'd like to consider before releasing a breaking version?

@nemobot nemobot added in review and removed WIP labels Feb 28, 2020
@BrianMitchL
Copy link
Contributor Author

Nothing I can think of related to hooks!

@giogonzo giogonzo merged commit 0936482 into buildo:master Feb 29, 2020
@nemobot
Copy link

nemobot commented Feb 29, 2020

@giogonzo
Copy link
Member

released as 4.0.0. Thanks @BrianMitchL!

@BrianMitchL BrianMitchL deleted the hooks branch February 29, 2020 17:40
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