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

[fix:dropdown, grid, modal] WB-554: update components for use with react-hot-loader #390

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

kevinbarabash
Copy link
Contributor

@kevinbarabash kevinbarabash commented Apr 26, 2019

The issue is that react-hot-loader wraps components in ReactProxy classes which breaks direct component class checks.

Test Plan:

  • use yarn link to test these components in webapp
  • load demos.jsx.fixture.js in the react sandbox
  • verify that all of the dropdowns and the modals work (the demos fixture doesn't have a grid example yet)

Aside: I really wanted to use Symbol so I could copy/paste the isClassOf snippet without having to modify it each time, but flow doesn't support computed static vars. 😞

@jeresig
Copy link
Member

jeresig commented Apr 26, 2019

Deploy preview for wonder-blocks ready!

Built with commit eb5e806

https://deploy-preview-390--wonder-blocks.netlify.com

@codecov
Copy link

codecov bot commented Apr 26, 2019

Codecov Report

Merging #390 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #390      +/-   ##
==========================================
+ Coverage    94.3%   94.32%   +0.02%     
==========================================
  Files         107      107              
  Lines        1492     1499       +7     
  Branches      288      295       +7     
==========================================
+ Hits         1407     1414       +7     
  Misses         79       79              
  Partials        6        6
Impacted Files Coverage Δ
...ponents/two-column-modal/small-two-column-modal.js 100% <ø> (ø) ⬆️
...ponents/one-column-modal/small-one-column-modal.js 100% <ø> (ø) ⬆️
packages/wonder-blocks-grid/components/cell.js 93.54% <100%> (+0.21%) ⬆️
...s/wonder-blocks-dropdown/components/action-item.js 94.11% <100%> (+0.36%) ⬆️
...ages/wonder-blocks-dropdown/components/dropdown.js 96.05% <100%> (ø) ⬆️
...s/wonder-blocks-dropdown/components/option-item.js 100% <100%> (ø) ⬆️
...ges/wonder-blocks-modal/components/modal-footer.js 100% <100%> (ø) ⬆️
...es/wonder-blocks-modal/components/modal-content.js 100% <100%> (ø) ⬆️
packages/wonder-blocks-grid/components/row.js 92.85% <100%> (ø) ⬆️
...ages/wonder-blocks-modal/components/modal-panel.js 93.75% <100%> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04d9519...eb5e806. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Apr 26, 2019

Codecov Report

Merging #390 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #390      +/-   ##
==========================================
+ Coverage    94.3%   94.32%   +0.02%     
==========================================
  Files         107      107              
  Lines        1492     1499       +7     
  Branches      288      295       +7     
==========================================
+ Hits         1407     1414       +7     
  Misses         79       79              
  Partials        6        6
Impacted Files Coverage Δ
...ponents/two-column-modal/small-two-column-modal.js 100% <ø> (ø) ⬆️
...ponents/one-column-modal/small-one-column-modal.js 100% <ø> (ø) ⬆️
packages/wonder-blocks-grid/components/cell.js 93.54% <100%> (+0.21%) ⬆️
...s/wonder-blocks-dropdown/components/action-item.js 94.11% <100%> (+0.36%) ⬆️
...ages/wonder-blocks-dropdown/components/dropdown.js 96.05% <100%> (ø) ⬆️
...s/wonder-blocks-dropdown/components/option-item.js 100% <100%> (ø) ⬆️
...ges/wonder-blocks-modal/components/modal-footer.js 100% <100%> (ø) ⬆️
...es/wonder-blocks-modal/components/modal-content.js 100% <100%> (ø) ⬆️
packages/wonder-blocks-grid/components/row.js 92.85% <100%> (ø) ⬆️
...ages/wonder-blocks-modal/components/modal-panel.js 93.75% <100%> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04d9519...eb5e806. Read the comment docs.

@somewhatabstract
Copy link
Member

Aside: I really wanted to use Symbol so I could copy/paste the isClassOf snippet without having to modify it each time, but flow doesn't support computed static vars. 😞

I wonder if they plan to or if this is a WON'T FIX.

@somewhatabstract
Copy link
Member

I found this and added a comment (mainly to revive it a bit - it hasn't been commented on since 2017 until today).

facebook/flow#2286

Copy link
Member

@jeresig jeresig left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@kevinbarabash kevinbarabash merged commit 8e577a1 into master Apr 30, 2019
@jandrade
Copy link
Member

Are these changes going to result in a new patch version for each component (e.g. v1.1.0 -> v1.1.1)? If that's the case, is that a manual change? or do we have a script that does that?

@kevinbarabash
Copy link
Contributor Author

@jandrade running yarn run publish runs lerna which provides a prompt to bump things. I'll update the title of this diff to indicate which package should be bumped.

@kevinbarabash kevinbarabash changed the title WB-554: update components for use with react-hot-loader [fix:dropdown, grid, modal] WB-554: update components for use with react-hot-loader Apr 30, 2019
@kevinbarabash
Copy link
Contributor Author

I should've changed the title before merging, d'oh.

kevinbarabash added a commit that referenced this pull request Oct 8, 2020
## Summary:
This PR add the new props `beforeNav` and `safeWithNav` to `Button` and `ClickableBehavior`.  These props were proposed in [ADR #390](https://docs.google.com/document/d/1p4UUOHEqhaXG7rVg7J4j6S0a83wF76QcPqnEJvrtqyA/edit) with one minor change, they must always return a promise.  This provides a clear separation of responsibility: synchronous actions should be handled by `onClick` (which can be used with or without an `href`) and asynchronous actions should be handled by `beforeNav` or `safeWithNav` depending on the desired behavior.

Since this PR modifies `ClickableBehavior` a number of other components required minor changes in order for flow type-checking to succeed.  Future PRs will finish updating these components to have `beforeNav` and `safeWithNav` props just like `Button`.

This PR also updates the build configuration so that async functions aren't transformed.

TODO:
- [ ] ~touch events~ this is already handled since we're relying on the mobile browser to synthesize a "click" event for us.
- [x] keyboard events
- [x] dedupe logic between mouse and keyboard event handling of `beforeNav` and `safeWithNav`
- [x] documentation
- [x] add tests for `beforeNav` and `safeWithNav` to clickable-behavior.test.js
- [x] add tests for `spinner` behavior

Issue: WEB-2990

## Test plan:
- yarn jest packages/wonder-blocks-button/components/__tests__/button.test.js

Reviewers: #fe-infra

Author: kevinbarabash

Reviewers: aag, kevinbarabash, jeresig

Required Reviewers: 

Approved by: jeresig, jeresig

Checks: ✅ Mixed content, ❓ Redirect rules, ❓ Header rules, ⏭  Auto-approve dependabot PRs, ❓ Pages changed, ✅ chromatic

Pull request URL: #1047
@jandrade jandrade deleted the action_menu_hot_loading_fix branch April 20, 2022 21:46
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.

5 participants