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: Don't include args param in docs mode URL #14494

Merged
merged 2 commits into from Apr 7, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/api/src/modules/url.ts
Expand Up @@ -151,11 +151,13 @@ export const init: ModuleFn = ({ store, navigate, state, provider, fullAPI, ...r
const initModule = () => {
// Sets `args` parameter in URL, omitting any args that have their initial value or cannot be unserialized safely.
const updateArgsParam = (args?: Story['args']) => {
const { path, viewMode } = fullAPI.getUrlState();
if (viewMode !== 'story') return;
const currentStory = fullAPI.getCurrentStoryData();
const initialArgs = (isStory(currentStory) && currentStory.initialArgs) || {};
const argsString = buildArgsParam(initialArgs, args);
const argsParam = argsString.length ? `&args=${argsString}` : '';
queryNavigate(`${fullAPI.getUrlState().path}${argsParam}`, { replace: true });
queryNavigate(`${path}${argsParam}`, { replace: true });
api.setQueryParams({ args: argsString });
};

Expand Down