Skip to content

fix: prioritize URL conversation_id over localStorage in embedded chatbot#35519

Merged
crazywoola merged 2 commits intolanggenius:mainfrom
treekimm:fix/embed-conversation-id-priority
Apr 28, 2026
Merged

fix: prioritize URL conversation_id over localStorage in embedded chatbot#35519
crazywoola merged 2 commits intolanggenius:mainfrom
treekimm:fix/embed-conversation-id-priority

Conversation

@treekimm
Copy link
Copy Markdown
Contributor

@treekimm treekimm commented Apr 23, 2026

Summary

  • Fix currentConversationId priority in embedded chatbot hook so URL-provided conversation_id takes precedence over localStorage
  • When embed.js passes a conversation_id parameter, it was ignored because conversationIdInfo from localStorage always won
  • Add tests verifying URL param priority and localStorage fallback behavior

fixes #35489

Related Issues

Test plan

  • pnpm test run app/components/base/chat/embedded-chatbot/__tests__/hooks.spec.tsx — 35 tests passed
  • Embed Dify chatbot via embed.min.js with a conversation_id param, verify it loads the correct conversation
  • Verify that without a URL conversation_id, localStorage fallback still works as before
  • Verify switching conversation_id via embed.js reloads the correct conversation

🤖 Generated with Claude Code

…tbot

When embed.js creates an iframe with a conversation_id parameter, the
embedded chatbot ignored it because localStorage's conversationIdInfo
always took higher priority. This caused new conversations to fail to
start when a previous conversation was already stored in localStorage.

Swap the priority order in currentConversationId so URL-provided
conversation_id takes precedence, falling back to localStorage only
when no URL param is present.

fixes langgenius#35489

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 23, 2026
@github-actions github-actions Bot added web This relates to changes on the web. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Apr 23, 2026
@dosubot dosubot Bot added the javascript Pull requests that update javascript code label Apr 23, 2026
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 23, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 28, 2026
@crazywoola crazywoola enabled auto-merge April 28, 2026 05:07
@crazywoola crazywoola added this pull request to the merge queue Apr 28, 2026
Merged via the queue into langgenius:main with commit 5a7a955 Apr 28, 2026
29 checks passed
fatelei pushed a commit that referenced this pull request Apr 29, 2026
…tbot (#35519)

Co-authored-by: KimNamWoo <treekim@KimNamWoos-Mac-mini.local>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

2 participants