Skip to content

Add URL-based chat navigation and history support#7

Merged
super3 merged 3 commits intomainfrom
claude/fix-task-list-default-CiQGJ
Apr 7, 2026
Merged

Add URL-based chat navigation and history support#7
super3 merged 3 commits intomainfrom
claude/fix-task-list-default-CiQGJ

Conversation

@super3
Copy link
Copy Markdown
Owner

@super3 super3 commented Apr 6, 2026

Summary

This PR adds URL-based navigation for chat sessions, allowing users to bookmark, share, and navigate between chats using browser history. The chat ID is now reflected in the URL hash and synchronized across navigation actions.

Key Changes

  • URL State Management: Added getChatIdFromUrl() and updateUrl() functions to parse and update the URL hash with the current chat ID in the format #/chat/{chatId}
  • Chat Loading: Modified loadChats() to check the URL for a specific chat ID and load that chat if it exists, falling back to the most recent chat
  • Chat Creation: Updated createNewChat() to update the URL when a new chat is created
  • Chat Switching: Modified switchToChat() to update the URL when switching between existing chats
  • Browser Navigation: Added hashchange event listener to handle browser back/forward button clicks, automatically switching to the appropriate chat when the URL hash changes

Implementation Details

  • The URL format follows a hash-based routing pattern (#/chat/{chatId}) to maintain compatibility with single-page application architecture
  • URL updates use history.replaceState() to avoid creating unnecessary history entries during initial loads
  • The hashchange event listener includes validation to ensure the chat exists before switching
  • All chat navigation paths (new chat, switch chat, URL navigation) now consistently update the URL state

https://claude.ai/code/session_017c7u8u7fjaozmihE6THSNz

@railway-app
Copy link
Copy Markdown

railway-app bot commented Apr 6, 2026

🚅 Deployed to the padtask-pr-7 environment in padtask

Service Status Web Updated (UTC)
padtask ✅ Success (View Logs) Web Apr 6, 2026 at 4:19 pm

@railway-app railway-app bot temporarily deployed to padtask / padtask-pr-7 April 6, 2026 15:08 Destroyed
@railway-app railway-app bot temporarily deployed to padtask / padtask-pr-7 April 6, 2026 15:10 Destroyed
claude added 2 commits April 6, 2026 16:05
When editing a task list, the URL now updates to #/chat/<sessionId>.
On page refresh, the app reads the hash to restore the correct chat
instead of always defaulting to the most recently created one.
Also handles browser back/forward navigation via hashchange listener.

https://claude.ai/code/session_017c7u8u7fjaozmihE6THSNz
16 tests covering getChatIdFromUrl, updateUrl, loadChats, createNewChat,
switchToChat, and an integration test verifying refresh preserves the
active chat via the URL hash.

https://claude.ai/code/session_017c7u8u7fjaozmihE6THSNz
@super3 super3 force-pushed the claude/fix-task-list-default-CiQGJ branch from 1eb97c5 to dcc0483 Compare April 6, 2026 16:05
@railway-app railway-app bot temporarily deployed to padtask / padtask-pr-7 April 6, 2026 16:05 Destroyed
URLs now look like #/chat/1712428800000-abc123xyz instead of
#/chat/session-1712428800000-abc123xyz.

https://claude.ai/code/session_017c7u8u7fjaozmihE6THSNz
@railway-app railway-app bot temporarily deployed to padtask / padtask-pr-7 April 6, 2026 16:07 Destroyed
@super3 super3 merged commit 8e6d026 into main Apr 7, 2026
3 checks passed
@super3 super3 deleted the claude/fix-task-list-default-CiQGJ branch April 7, 2026 16:13
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