Skip to content

Fix browser back trough latest version#932

Open
tbuerli-komax wants to merge 2 commits intodocat-org:mainfrom
tbuerli-komax:fix-browser-back-trough-latest-version
Open

Fix browser back trough latest version#932
tbuerli-komax wants to merge 2 commits intodocat-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
Copy link
Copy Markdown
Member

fliiiix commented Mar 30, 2026

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 :)

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