Skip to content

Commit

Permalink
Merge pull request #19540 from storybookjs/deprecate-remaining-previe…
Browse files Browse the repository at this point in the history
…w-web

remove deprecate features from preview-web
  • Loading branch information
ndelangen authored Oct 19, 2022
2 parents ec061e5 + 914191e commit 41b2917
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
7 changes: 0 additions & 7 deletions code/lib/preview-web/src/UrlStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ describe('UrlStore', () => {
viewMode: 'story',
});
});
it('should parse legacy queries', () => {
document.location.search = '?selectedKind=kind&selectedStory=story';
expect(getSelectionSpecifierFromPath()).toEqual({
storySpecifier: { title: 'kind', name: 'story' },
viewMode: 'story',
});
});
it('should parse args', () => {
document.location.search = '?id=story--id&args=obj.key:val';
expect(getSelectionSpecifierFromPath()).toEqual({
Expand Down
16 changes: 0 additions & 16 deletions code/lib/preview-web/src/UrlStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { SelectionSpecifier, Selection } from '@storybook/store';

import global from 'global';
import qs from 'qs';
import deprecate from 'util-deprecate';
import type { ViewMode } from '@storybook/addons';

import { parseArgsParam } from './parseArgsParam';
Expand Down Expand Up @@ -66,13 +65,6 @@ const getFirstString = (v: ValueOf<qs.ParsedQs>): string | void => {
return undefined;
};

const deprecatedLegacyQuery = deprecate(
() => 0,
`URL formats with \`selectedKind\` and \`selectedName\` query parameters are deprecated.
Use \`id=$storyId\` instead.
See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#new-url-structure`
);

export const getSelectionSpecifierFromPath: () => SelectionSpecifier | null = () => {
const query = qs.parse(document.location.search, { ignoreQueryPrefix: true });
const args = typeof query.args === 'string' ? parseArgsParam(query.args) : undefined;
Expand All @@ -90,14 +82,6 @@ export const getSelectionSpecifierFromPath: () => SelectionSpecifier | null = ()
return { storySpecifier: storyId, args, globals, viewMode };
}

// Legacy URL format
const title = getFirstString(query.selectedKind);
const name = getFirstString(query.selectedStory);

if (title && name) {
deprecatedLegacyQuery();
return { storySpecifier: { title, name }, args, globals, viewMode };
}
return null;
};

Expand Down

0 comments on commit 41b2917

Please sign in to comment.