Repository navigation
Conversation
|
Alternatively, we could change the backend superset/superset/views/dashboard/views.py Line 117 in 6575cac /new instead of /new/ and I think that would work too.
|
|
Hello everyone, I would like to know if this PR has been reviewed or if an alternative solution has been found? We currently have the same issue (superset version 4.0.6). |
fwiw, it should also be possible to add |
|
HI @dpgaspar |
|
Hi @ericsong! There's been continued community interest in this fix. Are you able to rebase and update this PR? If not, let us know and perhaps someone else from the community could pick it up. |
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
| const createButton = screen.getByRole('button', { name: /dashboard$/i }); | ||
| await userEvent.click(createButton); | ||
| expect(assignMock).toHaveBeenCalledWith('/dashboard/new'); | ||
| expect(assignMock).toHaveBeenCalledWith('/dashboard/new/'); |
There was a problem hiding this comment.
Suggestion: The test now expects the create-dashboard navigation to call window.location.assign with /dashboard/new/, but the implementation still navigates to /dashboard/new (without the trailing slash), so this assertion will fail and incorrectly flag the behavior as broken even though the component works as implemented. [logic error]
Severity Level: Minor
| expect(assignMock).toHaveBeenCalledWith('/dashboard/new/'); | |
| expect(assignMock).toHaveBeenCalledWith('/dashboard/new'); |
Why it matters? ⭐
The component calls navigateTo('/dashboard/new', { assign: true }) (see DashboardTable.tsx), which results in window.location.assign being invoked with '/dashboard/new' (no trailing slash). The test expects '/dashboard/new/' (with trailing slash) and will fail even though the component behavior is correct. Changing the assertion to '/dashboard/new' fixes a real logic mismatch between the test and implementation.
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/src/features/home/DashboardTable.test.tsx
**Line:** 244:244
**Comment:**
*Logic Error: The test now expects the create-dashboard navigation to call `window.location.assign` with `/dashboard/new/`, but the implementation still navigates to `/dashboard/new` (without the trailing slash), so this assertion will fail and incorrectly flag the behavior as broken even though the component works as implemented.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Nitpicks 🔍
|
|
CodeAnt AI finished reviewing your PR. |
|
@rusackas updated! the test is passing so I think the codeant review comment is incorrect |
|
Thanks @ericsong — there's clear continued demand for this one, sorry it's gone quiet. The branch has drifted back into conflict with master; one more rebase and we'll try to get it reviewed/merged. Also worth considering @landryb's note about adding @expose('/new') alongside /new/ for a backwards-compatible backend fix, if you'd prefer that route. Setting to draft for now, let me know if you need help driving it forward, I can try to push some commits. |
|
@ericsong this keeps biting people behind HTTPS proxies and you've gone quiet, so I'd like to carry it forward on a fresh PR. landryb's idea of just adding |
User description
SUMMARY
Currently, a request for a new dashboard (hitting /dashboard/new) will respond with a 308 permanent redirect because the UI hits
/dashboard/neweven though the backend exposes/dashboard/new/superset/superset/views/dashboard/views.py
Line 117 in 6575cac
Flask handles this case by responding with a 308 to the exposed version https://flask-cn.readthedocs.io/en/stable/api/#flask.Flask.route.
This PR changes routes in the frontend from
/dashboard/newto/dashboard/new/so that requests can be made without a 308 redirect.In our infrastructure setup, there's a problem with the 308 redirect and it points to an invalid address. I believe others have seen this problem as well in this issue #20577.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Reproduction Steps
/dashboard/newredirectionBefore

After

TESTING INSTRUCTIONS
See Reproduction Steps in section above
ADDITIONAL INFORMATION
CodeAnt-AI Description
Use /dashboard/new/ for creating dashboards to avoid 308 redirects
What Changed
Impact
✅ No 308 redirects when creating a new dashboard✅ Fewer broken dashboard creation flows in redirect-sensitive environments✅ Tests validate the correct create-dashboard URL💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.