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

Merge main (v1.5.0) into storybook-site #430

Merged
merged 18 commits into from
Feb 27, 2024

Conversation

nmanu1
Copy link
Contributor

@nmanu1 nmanu1 commented Feb 24, 2024

Since @storybook/addon-google-analytics doesn't support React 18, the Storybook site will have to stay on React 17. Updated the testing GH workflow and the test-site to reflect that this branch is using React 17 by default. Tracked the dev branch in Storm and checked that the Storybook site renders correctly and includes the new onDropdownInputChange prop for FilterSearch.

nmanu1 and others added 18 commits December 12, 2023 17:33
Merge main (v1.4.0) into develop
Merge main (v1.4.1) into develop
expose a callback prop to be called everytime after input changes in the FilterSearch component.
This enables greater customization for our Locators that are built using FilterSearch primarily

J=BACK-2765
TEST=manual
…havior, add documentation

specify a type for the props passed into onDropdownInputSelect and pass back the searchFields used
in the FilterSearch component so we can properly remove/keep the right filters

J=BACK-2765
TEST=manual
…pdownInputChange is specified

ensure executeFilterSearch is not called in test when onDropdownInputChange is supplied

J=BACK-2765
TEST=manual
…o args

move executeFilterSearch check to be outside a callback

J=BACK-2765
TEST=manual
This PR addresses the following vulnerabilities under test-site:

bump webpack version to 5.90.0
remove real live api key
J=VULN-37163,VULN-38428
TEST=auto

Ran npm run test. Spun up the test site and confirmed the pages are working.
The following changes were made to support React 18:
- Updated `react` and `react-dom` dev dependency versions from 17.0.2 to 18.2.0
- Updated peer dependencies to allow React 18
- Updated `react-collapsed` from v3.6.0 to v4.1.2 which supports React 18
- Copied `@reach/auto-id`'s `useId` hook  with minor modifications from https://github.com/reach/reach-ui/blob/dev/packages/auto-id/src/reach-auto-id.ts. Because the peer dependencies of that library don't allow React 18, we weren't able to install it directly anymore. This `useId` hook uses React 18's  `useId` hook if it's present and otherwise falls back to custom logic for React 16 and 17.
- Added a new `renderPin` prop to `MapboxMap` to allows React 18 users to render custom JSX into the DOM node for the marker element. This gets around the issue of having to call `createRoot` from `react-dom/client` in `MapboxMap`. This was causing issues on React 16/17 sites because Vite and Webpack were unable to determine that the dynamic import of `react-dom/client` wouldn't be reachable, and tried to resolve the package unsuccessfully. Rather than force existing consumers of the repo to update their bundler config to exclude `react-dom/client`, we provide this optional prop to React 18 users if they want to use React 18 features in their custom pin component, or if they don't want to get the console warning about using `ReactDOM.render` if they use the `PinComponent` prop.

To support testing in React 18:
- We are now fetching TextEncoder from utils when setting up the test environment because the new react-dom does not have it
- `@testing-library/react-hooks` doesn't support React 18 and it's functionality has now been added to `@testing-library/react` in v14. Because of this, `@testing-library/react` was upgraded to v14.2.1, which only supports React 18, and `@testing-library/react-hooks` was removed from the dev dependencies. The GitHub workflow for testing React 16 and 17 was updated to manually downgrade `@testing-library/react` to v12 and install `@testing-library/react-hooks`. Custom logic is added so that if `@testing-library/react-hooks` is installed, it's `renderHook` method is used (i.e. React 16/17), and otherwise the `renderHook` method from `@testing-library/react` is used (React 18).

J=BACK-2911, BACK-2923
TEST=auto, manual

Updated the test-site to use the new React 18 app initialization and tested all updated components manually to ensure they're not broken. Did a local npm pack of the repo and successfully used it in Pages repos with React 17 and 18.

Some updates were also made to clean up our tests:
- Upgraded `@testing-library/user-event` from v13.5.0 to v14.5.2, which makes async calls, so we no longer need `waitFor`. As part of this change, we started getting some new console errors when trying to navigate in tests by clicking links. This is because navigation is not defined in the jest jsdom environment. A util function was added to mock the console to remove these errors.
- Updated the GitHub test workflow for React 16 and 17 to manually install optional swc libraries because the post install script doesn't seem to run properly after we install specific versions of react-related packages. More info at swc-project/swc#5616 (comment)

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nidhi Manu <nmanu@yext.com>
### Features
- Add `onDropdownInputChange` optional prop to `FilterSearch` component (#421)
- Support React 18 (#423)

### Fixes
- Resolve vulnerabilities (#422)
*An automated PR which updates the version number in package.json and package-lock.json files*

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nidhi Manu <nmanu@yext.com>
### Features
- Added support for React 18 (#423)
- Added an optional `onDropdownInputChange` prop to `FilterSearch` (#421)

### Fixes
- Addressed vulnerabilities (#422)
@nmanu1 nmanu1 requested a review from a team as a code owner February 24, 2024 00:15
@coveralls
Copy link

Coverage Status

coverage: 85.757% (+0.2%) from 85.508%
when pulling 9e60c61 on dev/merge-main-v1.5.0-into-storybook-site
into c84397d on storybook-site.

Copy link
Contributor

Current unit coverage is 92.69746646795826%
Current visual coverage is 79.04761904761905%
Current combined coverage is 93.19761668321748%

@jesuyedavid jesuyedavid self-requested a review February 27, 2024 17:28
Copy link
Contributor

@jesuyedavid jesuyedavid left a comment

Choose a reason for hiding this comment

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

lgtm

@nmanu1 nmanu1 merged commit 492566b into storybook-site Feb 27, 2024
20 checks passed
@nmanu1 nmanu1 deleted the dev/merge-main-v1.5.0-into-storybook-site branch February 27, 2024 17:49
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