Skip to content

Fix browser back trough latest version - #932

Closed
tbuerli-komax wants to merge 2 commits into
docat-org:mainfrom
tbuerli-komax:fix-browser-back-trough-latest-version
Closed

Fix browser back trough latest version#932
tbuerli-komax wants to merge 2 commits into
docat-org:mainfrom
tbuerli-komax:fix-browser-back-trough-latest-version

Conversation

@tbuerli-komax

Copy link
Copy Markdown
Contributor

Bug: Browser back navigation doesn't work when navigating back through the "latest" version.

How to reproduce:

  1. For a new project, upload a documentation with a specific version, for example, v1.0.0
  2. Open the project by clicking on it. (browser URL should end in "/latest/")
  3. Navigate to a subpage of the documentation by clicking on a link. (browser URL should contain "/v1.0.0/")
  4. Through browser navigation, navigate back to the previous page. (browser URL should end in "/latest/")
  5. Results in "404 - Not Found", but should again display the root of the latest documentation, as it did in step 2.
  6. Additionally, the "Back to Project Home" on the error page doesn't work.

Changes done:

  • The first commit fixes the above-mentioned bug by splitting Version and DisplayVersion into different states.
  • While looking at the state handling and the requests done by the browser, it looked a bit off, and when looking closer, it turns out that navigations to the upload page did completely re-fetch the page from the server; this prevents the context managers from keeping the context. To fix this, the links were adapted to use the React Link Component. Further, a refresh logic was introduced to keep the versions displayed up to date. The refresh interval can be configured and is set to 30 seconds by default.

I hope this matches the coding style of the repository. It was a bit unclear to me where the documentation for the reloadIntervalSeconds should go. Is this better in the main README.md as an example parameter or in the web/README.md as an additional section?

…st" version, when the version is for example called v1.0.1, by splitting version and displayVersion in the code
…Context Providers to keep their state, to prevent them from showing outdated information a reloadIntervalSeconds with a default of 30s was introduced, to prevent flickering on project updates a diff logic was introduced before the state update and the iframe was adapted to only refresh if the current version changes. For example, adding versions to other Projects should not refresh the iframe nor should the iframe update when older versions get added to a Project.
@fliiiix

fliiiix commented Mar 30, 2026

Copy link
Copy Markdown
Member

Hoi 👋 thanks for your contribution can you please break this down into smaller merge requests? In the current state this is very hard to review.

It was a bit unclear to me where the documentation for the reloadIntervalSeconds should go.

I don't think this is a feature we want to support so you can drop it completely, which should resolve the need to document it :)

@tbuerli-komax

Copy link
Copy Markdown
Contributor Author

Thanks for the fast feedback. I will remove everything other than the bugfix from this Pull Request and create a separate one for React state handling / navigation improvements. This should also clarify which changes are required for which functionality.

@fliiiix

fliiiix commented Apr 8, 2026

Copy link
Copy Markdown
Member

@tbuerli-komax Did you see -> #934 which i believe is trying to fix the same issue

@tbuerli-komax

Copy link
Copy Markdown
Contributor Author

The merge request by ioasjfopas #934 chooses to update the parameter used by the URL directly. This has the tradeoff that navigation through the documentation changes the version in the URL away from "/latest" to the exact version.

@fliiiix please check both merge requests and give me feedback on which solution is preferred by you.
If it's this one, then please also advise if I should rebase the by then simplified version directly on top of #933

@fliiiix

fliiiix commented Apr 10, 2026

Copy link
Copy Markdown
Member

Thanks for this fix cherry-picked th the other mr and merged.

I will close these here but as discussed in the other mr i am interested in better testing for the navigation and a simpler implementation if thats something you want to work on im more than happy to see other mrs from you! ✨

@fliiiix fliiiix closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants