Skip to content

Manager: Remove persisted tag-filter state migration [SB-2022] - #36678

Merged
ndelangen merged 5 commits into
nextfrom
feat/sb-2022-remove-tag-filter-state-migration
Oct 12, 2026
Merged

ndelangen merged 5 commits into
nextfrom
feat/sb-2022-remove-tag-filter-state-migration

Conversation

@obvious-autobuild

@obvious-autobuild obvious-autobuild Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes SB-2022

What I did

Replaces the one-time storage rewrite in Store.getInitialState (TODO: Remove in SB 11) with a read-time omit of includedTagFilters and excludedTagFilters from local storage only. v10.3 wrote those keys with persistence: 'permanent'. If they are spread into initial state, the array-union merge revives them on every load. Dropping them before the spread keeps a direct 10.3 → 11 upgrade seamless, and nothing is written back to storage.

A TODO: Remove in SB 12 marks the omit. Session storage is unchanged. No migration note, because there is nothing for the user to clear.

  • code/core/src/manager-api/store.ts — local storage is destructured so those two keys never enter the merge.
  • code/core/src/manager-api/tests/store.test.js — seeds local storage with the two keys plus an unrelated key, and asserts the unrelated key and session state are kept. The existing storage-combine test reads each storage once.

Note for reviewers on local typecheck: tsc on an untouched origin/next checkout in our sandbox reports ~53 pre-existing react-aria module-resolution errors in files this PR does not touch; a stash-diff confirms the error set is identical with and without this change, and the manager-api sources are absent from it. CI's typecheck is the authoritative word.

Visual evidence: not applicable — state plumbing with no rendered output change

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

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. Run a sandbox, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts, and open Storybook in the browser.
  2. Select a couple of tag filters in the sidebar; they should apply, appear in the URL tags/statuses params, and survive a reload.
  3. Simulate a v10.3.x leftover: in devtools run localStorage.setItem('@storybook/manager/store', JSON.stringify({ includedTagFilters: ['custom'], excludedTagFilters: [], foo: 'bar' })), then reload. Expected: the leftover tag filters do not adopt into the URL or the filter menu, the foo control key survives untouched (storage is never rewritten at load), and Storybook behaves normally.
  4. Areas most likely to regress: initial manager state hydration and anything reading getStore().getInitialState(); every addon store initializes through this path, so compare behavior of core panels against next if anything looks off.

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-storybook/src/sandbox-templates.ts

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • 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 - 🚫 Not run

This PR does not have a canary release associated.

In-repo PRs: add the ci:canary label. Later pushes republish while the label remains.

Fork PRs: the label does nothing (a later push must not auto-publish). A maintainer publishes from this repository with Run workflow and the pr input. branch and sha are optional; if more than one is set, they must be the same commit. The fork author does not need to do anything.

🔗 Obvious Project · 🧵 Obvious Thread · 🔀 Obvious PR Artifact

…L era boundary

Tag-filter state has lived in the URL since v10.4.0; only v10.3.x persisted
includedTagFilters/excludedTagFilters to local/session storage. Removes the
one-time storage-rewrite migration in Store.getInitialState (TODO: Remove in
SB 11) and replaces it with a passive read-time strip that never adopts those
keys, so stale v10.3.x values cannot union-merge into URL-derived initial
state via the array-union deep merge in root.tsx. The strip is permanent,
not version-gated, and no storage write happens at init. Adds a test proving
legacy keys are dropped at read time and storage is left untouched; the
existing storage-combine test now mocks a single read per storage.
Documents under the 11.0.0 section that v10.3.x was the last release to
store sidebar tag filters in browser storage, that v10.4.0 moved the state
to the URL, that 11.0 never adopts the stored values (no action required),
and how to clear browser storage if old filters reappear after a direct
10.3.x → 11.0 upgrade.
@obvious-autobuild obvious-autobuild Bot added maintenance User-facing maintenance tasks ci:normal Run our default set of CI jobs (choose this for most PRs). qa:needed Pull Requests that will need manual QA prior to release. labels Oct 8, 2026
@obvious-autobuild
obvious-autobuild Bot marked this pull request as ready for review October 8, 2026 14:53
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

A direct 10.3 to 11 upgrade stays seamless if those keys never enter the initial-state merge. Drop the session strip, the helper, and the migration note, and leave a TODO to remove the omit in SB 12.
@ndelangen
ndelangen merged commit 271a436 into next Oct 12, 2026
145 checks passed
@ndelangen
ndelangen deleted the feat/sb-2022-remove-tag-filter-state-migration branch October 12, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal Run our default set of CI jobs (choose this for most PRs). maintenance User-facing maintenance tasks qa:needed Pull Requests that will need manual QA prior to release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants