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

Stay on same page when changing scopes #2631

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

johnnyomair
Copy link
Collaborator

Description

Previously, redirectPathAfterChange of useContentScopeConfig had to be explicitly set to ensure that the Admin stays on the same page after changing scopes.
This was often forgotten, resulting in redirects to the default page (usually the dashboard page).
Now, as it is the preferred behavior, the Admin will stay on the same page per default.

The previous behavior can be restored by using the useContentScopeConfig hook:

import { useContentScopeConfig } from "@comet/cms-admin";

function MainMenuPage() {
    // We want to redirect to the dashboard page after changing the scope.
    useContentScopeConfig({ redirectPathAfterChange: "/dashboard" });
}

Example

  • I have verified if my change requires an example

Changeset

  • I have verified if my change requires a changeset

Related tasks and documents

https://vivid-planet.atlassian.net/browse/COM-1102

@johnnyomair johnnyomair self-assigned this Oct 15, 2024
@nsams
Copy link
Member

nsams commented Oct 16, 2024

Was the old default chosen to avoid errors when the user doesn't have access to the current page in the new scope?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants