-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
chore: Set router basename to simplify paths in /ui #5004
chore: Set router basename to simplify paths in /ui #5004
Conversation
74278f9
to
34d2bb0
Compare
This is a really nice feature, thx! |
just checking is there anything required for updating the readme document for this change ? |
yeah might be better to write something here: https://docs.feast.dev/reference/alpha-web-ui |
@peruukki can you see if any document needs update for this change-> https://github.com/feast-dev/feast/blob/master/docs/reference/alpha-web-ui.md |
5b700be
to
2c98539
Compare
I added a subsection about the new prop, see it rendered in alpha-web-ui.md and ui/README.md. (I also did tiny other tweaks.) |
It now occurred to me that this is actually a breaking change if you were using Feast UI as a module in your app and using the So maybe that should be mentioned in the release notes? Let me know if you want me to change e.g. the PR title prefix from "chore" to something else due to this. |
2c98539
to
262cba8
Compare
Is there a way to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hold
+1 @peruukki any chance we can investigate this? |
To clarify, this doesn't remove the possibility to use If you were only defining the @@ -3,16 +3,19 @@ import ReactDOM from 'react-dom/client';
import './index.css';
import FeastUI from '@feast-dev/feast-ui';
import '@feast-dev/feast-ui/dist/feast-ui.css';
+const basename = process.env.PUBLIC_URL ?? '';
+
const root = ReactDOM.createRoot(document.getElementById('root')!);
root.render(
<StrictMode>
<FeastUI
+ basename={basename}
feastUIConfigs={{
- projectListPromise: fetch(`${process.env.PUBLIC_URL ?? ''}/projects-list.json`, {
+ projectListPromise: fetch(`${basename}/projects-list.json`, {
headers: {
'Content-Type': 'application/json',
},
}).then((res) => {
return res.json(); (And now looking at that, we could use I would prefer not to use environment variables inside the
|
ok I think that make sense. I like this feature because when I setup Superset it is very hard to have a ui prefix in the public URL. it would be convenient to have |
@franciscojavierarceo seems good to go. |
Related documentation: https://reactrouter.com/6.28.2/router-components/browser-router#basename. Signed-off-by: Harri Lehtola <peruukki@hotmail.com>
262cba8
to
78e429d
Compare
@franciscojavierarceo I reduced the scope of this PR and made it purely refactoring, i.e. no externally visible changes. It's better to make such changes separately after this. |
What this PR does / why we need it:
Sets the React Router basename to avoid repeating the
PUBLIC_URL
environment variable.Which issue(s) this PR fixes:
This is pretty much a re-do of #3541 but with only internal changes. Related short discussion started in #3514 (comment).
Misc
I verified that the environment variable still works by starting the app with

PUBLIC_URL=/feast-ui yarn start
(alsoPUBLIC_URL=http://localhost:3000/feast-ui yarn start
somehow works):Note: I originally included some changes that affected the behavior (see discussion below), but eventually decided to keep this as purely refactoring, and make other kinds of improvements separately.