kedro-org / kedro-viz

Visualise your Kedro data and machine-learning pipelines and track your experiments.
https://demo.kedro.org
Apache License 2.0
682 stars 113 forks source link

Handle Github pages 404 issue #2179

Closed jitu5 closed 2 weeks ago

jitu5 commented 2 weeks ago

Description

Resolves https://github.com/kedro-org/kedro-viz/issues/2048

This pull request includes changes to fix a 404 error on the experiment tracking page, and to ensure the 404 page is correctly redirect to root and manage by React router internally by keeping the content of the index.html and 404.html same.

Development notes

Redirect handling:

QA notes

I have deployed the changes to Github pages https://jitu5.github.io to test.

Checklist

astrojuanlu commented 2 weeks ago

Watching this in slow motion was... interesting 😄

kedro-viz-404

On the other hand, actual faulty URLs are handled in a strange way now:

image

Compare that with how it's handled locally:

image

I think this is smart but I fear it might have some unintended consequences...

jitu5 commented 2 weeks ago

@astrojuanlu In slow motion you show that text "// in 404.html // in 404.html" was just for testing, I forgot to deploy the latest one , but now its updated. now it shows "Redirecting..."

Screenshot 2024-11-08 at 11 15 33 a m
jitu5 commented 2 weeks ago

@astrojuanlu

On the other hand, actual faulty URLs are handled in a strange way now:

I fixed it now, if any sub path other than experiment-tracking is hit directly like this https://jitu5.github.io/experiment-trackingadsd, now it will be redirect to home/landing page.

jitu5 commented 2 weeks ago

@astrojuanlu

Compare that with how it's handled locally:

This approach is specifically added for Github pages, on hitting faulty URLs it redirect you to our custom 404.html but locally thing works same as before.

jitu5 commented 2 weeks ago

Did you try using the exact same contents of the index.html file for the 404.html?

I just had to solve this issue for AlloyViz, which is also deployed to GH pages.

This is how I did it:

"build": "tsc && vite build && cp ./dist/index.html ./dist/404.html",

Might not be the same. Wanted to share my findings in case they were helpful!

@tynandebold Thanks for sharing your finding. But using same content for 404.html from index.html is redirecting to landing page or root but, how you retain the original url and its params entered by user and then redirect to the same using client-side React-router ?

This is even clear solution, I got once the control goes to client-router(React-router) it handle as normal button click or history.push(url). I will update the PR. Thanks @tynandebold again.