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

[NO-TICKET] Use new docgen union sorting #3166

Merged

Conversation

pwolfert
Copy link
Collaborator

Summary

How to test

  1. yarn clean && yarn install && yarn build
  2. yarn test:browser:storybook-docs and make sure it doesn't try to change the order of union-type members from what the snapshots show now (string-stort (somewhat alphabetical) order)

…member sorting

Right now I'm trying to figure out why the prop table on the Drawer page isn't rendering
@pwolfert pwolfert requested a review from zarahzachz July 22, 2024 17:57
Copy link
Collaborator

@zarahzachz zarahzachz left a comment

Choose a reason for hiding this comment

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

everything passed locally

@pwolfert
Copy link
Collaborator Author

Going to just merge this for now since it works. We can follow up with a dependency version bump when the library does a real release and maybe even after the @storybook/react-docgen-typescript-plugin library bumps the version that it uses so we don't have to create a custom resolution in our package file.

@pwolfert pwolfert merged commit 14a7aa5 into WNMGDS-2698/upgrade-storybook Jul 23, 2024
@pwolfert pwolfert deleted the pwolfert/use-docgen-union-sorting branch July 23, 2024 21:44
zarahzachz added a commit that referenced this pull request Jul 24, 2024
* bump storybook to latest packages

* update storybook files using SB migration scripts

* use correct markdown comment structure

* replace ArgsTable with ArgTypes - seems to work

* Fix reading of story files from tests

* Fix old references to `ArgsTable`

* [NO-TICKET] Upgrade React types to fix Storybook 8 branch (#3080)

* WIP: Try upgrading the react types and working through errors

Here's the summary of errors we're starting with:

```
Found 109 errors in 28 files.

Errors  Files
     4  packages/design-system/src/components/Accordion/Accordion.stories.tsx:8
     3  packages/design-system/src/components/Alert/Alert.stories.tsx:6
     1  packages/design-system/src/components/Autocomplete/utils.tsx:15
    11  packages/design-system/src/components/ChoiceList/ChoiceList.stories.tsx:7
     4  packages/design-system/src/components/Drawer/Drawer.stories.tsx:29
    12  packages/design-system/src/components/Dropdown/Dropdown.stories.tsx:8
     6  packages/design-system/src/components/Dropdown/Dropdown.tsx:171
     1  packages/design-system/src/components/Dropdown/DropdownMenuOption.tsx:66
     5  packages/design-system/src/components/HelpDrawer/HelpDrawer.stories.tsx:29
     4  packages/design-system/src/components/IdleTimeout/IdleTimeout.stories.tsx:10
     4  packages/design-system/src/components/PrivacySettingsDialog/PrivacySettingsDialog.stories.tsx:17
     6  packages/design-system/src/components/Spinner/Spinner.stories.tsx:6
    23  packages/design-system/src/components/TextField/TextField.stories.tsx:10
     2  packages/design-system/src/components/Tooltip/Tooltip.tsx:357
     1  packages/design-system/src/components/UsaBanner/UsaBanner.stories.tsx:5
     1  packages/design-system/src/components/web-components/ds-accordion/ds-accordion.tsx:22
     1  packages/design-system/src/components/web-components/preactement/define.test.tsx:35
     1  packages/docs/src/components/content/ContentRenderer.tsx:111
     1  packages/docs/src/components/content/EmbeddedExample.tsx:17
     2  packages/docs/src/components/layout/SideNav/SideNav.tsx:25
     2  packages/docs/src/components/layout/TableOfContents.tsx:43
     1  packages/docs/src/components/page-templates/BlogPage.tsx:18
     1  packages/docs/src/pages/blog.tsx:33
     2  packages/ds-healthcare-gov/src/components/Accordion/Accordion.stories.tsx:8
     2  packages/ds-medicare-gov/src/components/Card/Card.stories.tsx:6
     5  packages/ds-medicare-gov/src/components/HelpDrawer/HelpDrawer.stories.tsx:31
     1  packages/ds-medicare-gov/src/components/SimpleFooter/SimpleFooter.stories.tsx:6
     2  packages/ds-medicare-gov/src/components/Stars/stars.stories.tsx:6
```

* Fixing the first batch of errors (down to 89 from 109)

* Remove custom docs config for Drawer storybook page and fix VRTs

Add new interaction VRTs for dialog and drawer, and don't have any of the stories open them automatically

* Trying to fix missing Drawer story controls but failing

I was hoping fixing these types would do it.

* Ignore errors coming from react-aria types

* Two different ways of getting around the errors for inlining the doc page JSX

* Down to 24 errors

* Finished fixing all the errors in the core package (down to 20 now)

* Huh, the errors just go away after making some edits to the yarn lockfile

I think I'll go back and undo some of my previous commits to see if I need them

* Just realized there was some dead code in here

* Revert "Ignore errors coming from react-aria types"

This reverts commit f4fac88.

* Revert more of the react-aria changes

This reverts part of commit ffc035d.

* I can revert this change too

* Oh no, these new arg tables do not look good

It seems as though the type inference has gotten worse in this version. Instead of the type for Badge `size` being listed as `big` (only supports big), it is now reported as `literal`. For `string | React.ReactNode`, it only says `union`. Instead of `type` being `checkbox` and `radio`, it’s `union`. Instead of `ReactNode` for `React.ReactNode`, it prints out as `ReactReactNode`

* Revert "Oh no, these new arg tables do not look good"

This reverts commit 6811f4b.

* Changing the default settings to use the typescript docgen results in much fewer changes

See storybookjs/storybook#26496

* update vrt snaps, drawer stories renamed

* [NO-TICKET] Use new docgen union sorting (#3166)

* Use the new beta version of `react-docgen-typescript` that has union-member sorting

Right now I'm trying to figure out why the prop table on the Drawer page isn't rendering

* The arg table was gone because it wasn't included in the template

* Update VRT changes from this branch with underline style changes from `main`

* Go back to the Drawer story setup from c930062

In the interaction tests, we were trying to use features of the story (the toggle) that didn't exist, which is why they were failing. I think the original reason I changed the drawer stories was to make them consistent with the dialog stories, and I was also able to consolidate them down to one. That necessitated the interaction tests because the drawer was no longer open by default for a screenshot to be taken.

---------

Co-authored-by: Patrick Wolfert <patrick.wolfert@adhocteam.us>
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.

2 participants