Closed xiaoqufengdi closed 1 day ago
To get the server to recognize a new route added in the front end (superset-frontend) so that it works when you refresh the browser globally (Ctrl + R), you need to ensure that the backend server is aware of the new route. This typically involves configuring the server to handle the new route and serve the appropriate frontend application.
Here is how you can do it:
Add the new route to the frontend routes configuration:
export const routes: Routes = [
// ... existing routes
{
path: '/new/route/',
Component: NewComponent, // Replace with your new component
},
// ... existing routes
];
Ensure the backend recognizes the new route:
In the Flask app configuration (usually in superset/views/core.py
or a similar file), add a new route to handle the new path. For example:
from flask import render_template
from superset import app
@app.route('/new/route/')
def new_route():
return render_template('index.html')
This ensures that when the server receives a request for /new/route/
, it serves the frontend application, allowing the React Router to take over and render the appropriate component.
By following these steps, you ensure that both the frontend and backend are aware of the new route, and it will work correctly when you refresh the browser globally (Ctrl + R) [1].
To continue talking to Dosu, mention @dosu.
Bug description
We are redeveloping superset, I add a new route at the front end(superset-frontend). but it doesn't work when I refresh the browser globally(Ctrl + R). I know some pages are rendered on the server side, how do I get the server to recognize this new route?
How to reproduce the bug
When I add a new route at the front end(superset-frontend), then I refresh the browser globally(Ctrl + R), l find that the route cannot be found.
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
18 or greater
Browser
Chrome
Additional context
No response
Checklist