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

UI: Remove defaultProps from Link component #25619

Merged
merged 5 commits into from
Jan 22, 2024

Conversation

tsvanharen
Copy link
Contributor

Closes #24305

What I did

In the already-closed issue referenced above, only a partial fix was originally applied. This PR completes the entire fix by removing defaultProps from the Link typography component, as reinforced and confirmed by this comment on the issue. To summarize, this PR fixes the dev console warning Warning: Link2: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

This change should be functionally equivalent to its previous state (moving default prop values from the deprecated defaultProps object to the functional component's prop arguments).

Manual testing

Steps to reproduce the issue and verify the fix:

  1. Pull down and switch to the next branch, which does not contain this fix.
  2. Run yarn task --task sandbox --start-from install --template nextjs/default-ts. This will take a few minutes to run. Once this completes, if the Storybook sandbox doesn't open in your browser, cd into sandbox/nextjs-default-ts and run yarn storybook.
  3. In the Storybook sandbox that spun up, open your browser's dev console, and drill down to Stories > renderers > react > decorators > Docs.
  4. Note the output in the dev console: Warning: Link2: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.
  5. Kill the server in the terminal and pull down and switch to the branch from this PR.
  6. Repeat steps 2 and 3 above.
  7. Note that this warning no longer appears in the dev console.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

@JReinhold JReinhold self-assigned this Jan 22, 2024
@JReinhold JReinhold added ui maintenance User-facing maintenance tasks ci:normal labels Jan 22, 2024
Copy link
Contributor

@JReinhold JReinhold 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 this. ❤️

@JReinhold
Copy link
Contributor

JReinhold commented Jan 22, 2024

The failing unit test looks unrelated to this PR, but could you fix the lint issue, then this should be ready to merge @tsvanharen

/tmp/storybook/code/ui/components/src/components/typography/link/link.tsx
  207:1  error  Delete `⏎`  prettier/prettier

@tsvanharen
Copy link
Contributor Author

The newline issue has been fixed.

@JReinhold JReinhold changed the title Remove defaultProps from Link component to fix console warning UI: Remove defaultProps from Link component Jan 22, 2024
@JReinhold JReinhold merged commit f2d311b into storybookjs:next Jan 22, 2024
47 of 49 checks passed
@github-actions github-actions bot mentioned this pull request Jan 22, 2024
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:normal maintenance User-facing maintenance tasks ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Support for defaultProps will be removed from function components in a future major release.
3 participants