Skip to content

fix(history): normalize memory history hrefs - #8359

Merged
Sheraff merged 1 commit into
mainfrom
codex/normalize-memory-history-hrefs
Sep 12, 2026
Merged

Sheraff merged 1 commit into
mainfrom
codex/normalize-memory-history-hrefs

Conversation

@Sheraff

@Sheraff Sheraff commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

🎯 Changes

Memory history normalizes locations through parseHref, but its createHref currently returns the input unchanged. For example, pushing //example.com/path produces the location /example.com/path, while formatting the same input produces a protocol-relative link.

Use normalizeHref in memory history's createHref so generated hrefs match navigation and the browser/server history implementations. Add 13 regression cases covering protocol-relative prefixes, slash/backslash variants, control characters, and preservation of ordinary and encoded paths. Include a patch changeset for @tanstack/history.

Follow-up to #8308 and #8354.

Validation:

  • Confirmed eight new cases fail before the fix; all 118 history tests pass afterward.
  • pnpm test:eslint --outputStyle=stream --skipRemoteCache
  • pnpm test:types --outputStyle=stream --skipRemoteCache
  • pnpm test:unit --outputStyle=stream --skipRemoteCache
  • Prettier and git diff --check.
  • React basic example browser smoke test, including a native anchor check against the built memory-history implementation.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with the relevant test commands, or tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes
    • Memory history links are now normalized consistently with browser and server history.
    • Protocol-relative paths and control characters are handled correctly when generating links.
    • Generated links now resolve to the application’s origin and remain consistent after navigation.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-11T11:38:51.368660Z 1d66db4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 5bdad269-0816-44ce-af98-a3263531b5d6

📥 Commits

Reviewing files that changed from the base of the PR and between 9872d2a and 1d66db4.

📒 Files selected for processing (3)
  • .changeset/happy-turkeys-write.md
  • packages/history/src/index.ts
  • packages/history/tests/createMemoryHistory.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Memory history now normalizes hrefs through normalizeHref. Parameterized tests verify consistency with navigation across slash, whitespace, control-character, encoded, and multi-slash inputs. A patch changeset documents the update.

Changes

Memory history href normalization

Layer / File(s) Summary
Normalize and validate memory history hrefs
packages/history/src/index.ts, packages/history/tests/createMemoryHistory.test.ts, .changeset/happy-turkeys-write.md
createMemoryHistory.createHref now applies normalizeHref. Tests verify normalized output, unchanged location state, same-origin resolution, and consistency with history.push. A patch changeset documents the behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 1d66d

Memory history href generation is aligned with navigation behavior and covered by regression tests; no actionable merge risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: normalizing hrefs in memory history.
Description check ✅ Passed The description explains the motivation, implementation, tests, release impact, and related issue. It includes the required changeset and validation details. Only the non-critical checklist item confi…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/normalize-memory-history-hrefs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 1d66db4

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 11m 38s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2m 14s View ↗

☁️ Nx Cloud last updated this comment at 2026-09-11 11:49:41 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

3 package(s) bumped directly, 21 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/history 1.162.3 → 1.162.4 Changeset
@tanstack/router-core 1.171.29 → 1.171.30 Changeset
@tanstack/start-server-core 1.169.34 → 1.169.35 Changeset
@tanstack/react-router 1.170.35 → 1.170.36 Dependent
@tanstack/react-start 1.168.52 → 1.168.53 Dependent
@tanstack/react-start-client 1.168.33 → 1.168.34 Dependent
@tanstack/react-start-rsc 0.1.51 → 0.1.52 Dependent
@tanstack/react-start-server 1.167.40 → 1.167.41 Dependent
@tanstack/router-cli 1.167.35 → 1.167.36 Dependent
@tanstack/router-generator 1.167.35 → 1.167.36 Dependent
@tanstack/router-plugin 1.168.37 → 1.168.38 Dependent
@tanstack/router-vite-plugin 1.167.37 → 1.167.38 Dependent
@tanstack/solid-router 1.170.33 → 1.170.34 Dependent
@tanstack/solid-start 1.168.50 → 1.168.51 Dependent
@tanstack/solid-start-client 1.168.32 → 1.168.33 Dependent
@tanstack/solid-start-server 1.167.39 → 1.167.40 Dependent
@tanstack/start-client-core 1.170.29 → 1.170.30 Dependent
@tanstack/start-plugin-core 1.171.42 → 1.171.43 Dependent
@tanstack/start-static-server-functions 1.167.34 → 1.167.35 Dependent
@tanstack/start-storage-context 1.167.31 → 1.167.32 Dependent
@tanstack/vue-router 1.170.32 → 1.170.33 Dependent
@tanstack/vue-start 1.168.49 → 1.168.50 Dependent
@tanstack/vue-start-client 1.167.35 → 1.167.36 Dependent
@tanstack/vue-start-server 1.167.39 → 1.167.40 Dependent

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@8359

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@8359

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@8359

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@8359

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@8359

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@8359

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@8359

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@8359

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@8359

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@8359

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@8359

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@8359

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@8359

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@8359

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@8359

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@8359

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@8359

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@8359

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@8359

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@8359

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@8359

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@8359

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@8359

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@8359

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@8359

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@8359

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@8359

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@8359

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@8359

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@8359

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@8359

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@8359

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@8359

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@8359

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@8359

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@8359

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@8359

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@8359

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@8359

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@8359

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@8359

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@8359

commit: 1d66db4

@codspeed

codspeed Bot commented Sep 11, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 180 untouched benchmarks


Comparing codex/normalize-memory-history-hrefs (1d66db4) with main (9872d2a)

Open in CodSpeed

@Sheraff
Sheraff merged commit 8fff7fa into main Sep 12, 2026
26 checks passed
@Sheraff
Sheraff deleted the codex/normalize-memory-history-hrefs branch September 12, 2026 19:57
@github-actions github-actions Bot mentioned this pull request Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant