šŸ›(Bug) Browser Back after creating a doc reopens /docs/new and creates another doc

Open Beginner friendly
#3,014 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

@tridev-tej is already working on this.

Since Nov 23, 2026.

  • #3051 by @tridev-tej — open
  • #3056 by @sanketpatel32 — open

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript
Domain
frontend

Research direction

The issue points to src/frontend/apps/impress/src/pages/docs/new/index.tsx, lines 34–39. Read redirectToDoc and check how it updates browser history after creating a document. Done means Back returns to the page that opened ā€œNew docā€ without creating another document.

Written by the indexing model from the issue text.

Description

bug frontend good first issue

After creating a doc with the "New doc" button, the browser Back button lands on /docs/new instead of the previous page, so a new document is created again and the user is sent forward to it: every Back press creates one more doc. The /docs/new page stays in the history because it redirects with router.push:
https://github.com/suitenumerique/docs/blob/2fa8605366600249c70fd9ab56c89ffc4852b5a5/src/frontend/apps/impress/src/pages/docs/new/index.tsx#L34-L39
Suggested fix: use router.replace in redirectToDoc, so /docs/new is swapped for the doc in the history and Back goes to the page that held the button (the login redirect on the same page already uses window.location.replace).

Dominant language
TypeScript
Stars
17k
Forks
705
Avg merge
4d 13h
Merged PRs (30d)
47

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from suitenumerique/docs

All issues in suitenumerique/docs

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.