Skip to content

don't write no-ops as new URL history items#4813

Merged
stuartc merged 6 commits into
mainfrom
triple-click-to-go-back-once
Jun 4, 2026
Merged

don't write no-ops as new URL history items#4813
stuartc merged 6 commits into
mainfrom
triple-click-to-go-back-once

Conversation

@taylordowns2000
Copy link
Copy Markdown
Member

Description

This pr closes #4812 by preventing no-ops (where previous URL == new URL) from being added as new URL history items.

Validation steps

  1. Go to workflow list
  2. Click into workflow
  3. Click back
  4. See that it works after a single click, not 3 clicks

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

@github-project-automation github-project-automation Bot moved this to New Issues in Core May 29, 2026
@github-actions
Copy link
Copy Markdown

Security Review ✅

  • S0 (project scoping): N/A — change is entirely client-side history.pushState deduplication in assets/js/react/lib/use-url-state.ts:105, no data access.
  • S1 (authorization): N/A — no new web-layer actions, controllers, or LiveView events introduced.
  • S2 (audit trail): N/A — no config-resource writes; only browser URL/history behavior changed.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.3%. Comparing base (f590caa) to head (912c43b).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #4813   +/-   ##
=====================================
  Coverage   90.3%   90.3%           
=====================================
  Files        444     444           
  Lines      22577   22577           
=====================================
+ Hits       20393   20396    +3     
+ Misses      2184    2181    -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@theroinaochieng theroinaochieng requested a review from lmac-1 June 3, 2026 09:12
Copy link
Copy Markdown
Collaborator

@lmac-1 lmac-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added an extra commit to extend this fix to replaceSearchParams for housekeeping. Double checked and this shouldn't have any extra implications. Approved

stuartc added 2 commits June 4, 2026 09:56
The no-op guard added in #4813 covered updateSearchParams and
replaceSearchParams but not updateHash, and was order-sensitive — a
reorder-only param write still stacked a duplicate history entry.

Extract a shared pushIfChanged guard (order-insensitive via sorted
search params) and a currentURL helper that all three writers seed
from, so every history write goes through one correct check.
Copy link
Copy Markdown
Member

@stuartc stuartc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taylordowns2000 I made a few tweaks here:

Two gaps with the guard/is the url the same. updateHash didn't have it, although it's not actually being called by anything right now which is weird but I'm hesitant to remove it because it's not impossible we will use hash state urls again and if used it'd still push a history entry on a no-op and could bring the stacking bug back. Routed that through a shared function guard too (nothing calls it yet, so just being safe).

The check was order-sensitive - it compared full URL strings, so if replaceSearchParams got the same params in a different order it didn't match and pushed a dupe anyway. Made the comparison ignore param order so a reorder counts as a no-op.

Added a little currentURL helper the three writers seed from - so there's one correct guard instead of two copies and one missing. Ended up being slightly less code overall. Added tests for the new cases too.

@stuartc stuartc merged commit c1bc757 into main Jun 4, 2026
7 checks passed
@stuartc stuartc deleted the triple-click-to-go-back-once branch June 4, 2026 08:43
@github-project-automation github-project-automation Bot moved this from New Issues to Done in Core Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Must click "back" 3x to go back after navigating to canvas

3 participants