morngaraf commented on PR #33356:
URL: https://github.com/apache/superset/pull/33356#issuecomment-2854736168
@irodriguez-nebustream
Thank you for opening a PR to fix the issue. I noticed it as well, but ended
up monkey patching during deployment on my side for the time-being.
In my first attempt I tried to replace only `/api/v1/me/roles/` with the
expected path, but it was not enough: React routes, e.g. `<Route
path="/embedded/:uuid/" component={EmbeddedRoute} />`, are also broken. When I
"fixed" the routes, dashboard started loading, but all API calls the dashboard
itself is making (like `/api/v1/dashboard` etc.) were still using the wrong
path.
I suspect that the following changes have to be done to fix all of the above:
```ts
import getBootstrapData, { applicationRoot } from
'src/utils/getBootstrapData';
...
const EmbeddedApp = () => (
<Router basename={applicationRoot()}>
{/* todo (embedded) remove this line after uuids are deployed */}
<Route path="/dashboard/:idOrSlug/embedded/" component={EmbeddedRoute} />
<Route path="/embedded/:uuid/" component={EmbeddedRoute} />
</Router>
);
...
function setupGuestClient(guestToken: string) {
setupClient({
appRoot: applicationRoot(),
guestToken,
guestTokenHeaderName: bootstrapData.config?.GUEST_TOKEN_HEADER_NAME,
unauthorizedHandler: guestUnauthorizedHandler,
});
}
```
`<Router basename={applicationRoot()}>` is taken from `App.tsx`,
`setupClient({ appRoot: applicationRoot() });` is used in `preamble.ts`.
Since `makeApi` by default uses singleton of `SupersetClient`, which is
configured by `setupClient`, we should not have to modify the actual
'/api/v1/me/roles/' endpoint with these changes, and all other "broken" api
calls should also be fixed automatically.
Anyways, these are simply my guesses and I'm quite new to Superset. Maybe
later this month I or one of my colleagues will have time to verify the
theories locally, and we would be happy to help moving this forward.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]