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

Core: Remove state deprecation warnings by default #21367

Merged
merged 3 commits into from Mar 3, 2023

Conversation

tmeasday
Copy link
Member

@tmeasday tmeasday commented Mar 3, 2023

Closes #20728

What I did

Move deprecation warnings for old state fields so they don't always trigger.

I wanted to have these deprecations be defined in the file that defines the relevant APIs, but it was hard to avoid a getter being called when the substate was being cloned into a larger state. There's probably a tricky way to do it, but I think this is fine. We are only concerned with people calling useStorybookState anyway.

How to test

  1. Check for lack of warnings in a sandbox by default
  2. Call useStorybookState().storiesHash in the manager somewhere, say in .storybook/manager.jsx:
import React from 'react';
import { useStorybookState, addons, types } from '@storybook/manager-api';

addons.register('xyz', () => {
  addons.add('xyz', {
    type: types.TOOL,
    title: 'test',
    render: () => {
      useStorybookState().storiesHash;
      return <div />;
    }
  });
});

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@shilman shilman merged commit 2e64fa4 into next Mar 3, 2023
@shilman shilman deleted the 20728-fix-state-warnings branch March 3, 2023 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove warnings generated by deprecated state fields
3 participants