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

[Bug] Custom Route definition now needed to include PUBLIC_URL #4692

Open
salimkanoun opened this issue Jan 15, 2025 · 2 comments
Open

[Bug] Custom Route definition now needed to include PUBLIC_URL #4692

salimkanoun opened this issue Jan 15, 2025 · 2 comments
Assignees
Labels
Bug Verified Bug reported, reproducible, and verified.

Comments

@salimkanoun
Copy link
Contributor

salimkanoun commented Jan 15, 2025

Describe the Bug

When defining a customization moodle to register a custom root, now it requires to include the PUBLIC_URL in the root,

i'm using "/viewer-ohif/" in PUBLIC_URL on building

Previously I was OK with :

      {
        name: 'loginRoute',
        value: {
          id: 'customRoutes',
          routes: [
            {
              path: `/login`,
              children: () => RootGaelO(),
              private: true,
            },
            
          ],
        },
      },

and now I need to add the /viewer-ohif/ in the root definition

      {
        name: 'loginRoute',
        value: {
          id: 'customRoutes',
          routes: [
            {
              path: `/viewer-ohif/login`,
              children: () => RootGaelO(),
              private: true,
            },
            
          ],
        },
      },

That't problematic because the root defintion is now dependant on the build context.

Steps to Reproduce

  1. Define a custom route in customization module without the public url in it
  2. build with a public url
  3. try to access the root

The current behavior

Non accessible route

The expected behavior

Route definition should be independant from the build setting to be able to be used in different context

OS

Linux

Node version

20

Browser

Chrome latest

@salimkanoun salimkanoun added the Awaiting Reproduction Can we reproduce the reported bug? label Jan 15, 2025
@salimkanoun salimkanoun changed the title [Bug] Custom Route definition now needed to include public URL [Bug] Custom Route definition now needed to include PUBLIC_URL Jan 15, 2025
@salimkanoun
Copy link
Contributor Author

salimkanoun commented Jan 15, 2025

OK I found the solution by injecting window.PUBLIC_URL

  {
        name: 'loginRoute',
        value: {
          id: 'customRoutes',
          routes: [
            {
              path: `${window.PUBLIC_URL}login`,
              children: () => RootGaelO(),
              private: true,
            },
            
          ],
        },
      },

@salimkanoun
Copy link
Contributor Author

reopen to discuss it tomorow (probably need to document it or add public URL while registering route)

@salimkanoun salimkanoun reopened this Jan 15, 2025
@sedghi sedghi added Bug Verified Bug reported, reproducible, and verified. and removed Awaiting Reproduction Can we reproduce the reported bug? labels Jan 16, 2025
@linear linear bot assigned sedghi Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Verified Bug reported, reproducible, and verified.
Projects
None yet
Development

No branches or pull requests

2 participants