fix: skip canvas SSE fetch in chat shared page to eliminate spurious 103 error#14190
Conversation
Signed-off-by: noob <[email protected]>
📝 WalkthroughWalkthroughThe changes add conditional gating to the SSE flow fetching hook by introducing an Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/src/pages/next-chats/share/index.tsx (1)
47-47: Rename constant to follow project naming rule.Please rename
isAgentto PascalCase to match the repository convention for constants.Suggested rename
- const isAgent = from === SharedFrom.Agent; - const { data: flowData } = useFetchFlowSSE(isAgent); + const IsAgent = from === SharedFrom.Agent; + const { data: flowData } = useFetchFlowSSE(IsAgent); - const avatarDialogSrc = - isAgent ? flowData?.avatar : chatInfo.avatar; + const avatarDialogSrc = + IsAgent ? flowData?.avatar : chatInfo.avatar;As per coding guidelines,
web/**/*.{ts,tsx,js,jsx}: UsePascalCasefor constants and component names in TypeScript/JavaScript.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/src/pages/next-chats/share/index.tsx` at line 47, Rename the constant `isAgent` to PascalCase (e.g., `IsAgent`) in this module: change the declaration const isAgent = from === SharedFrom.Agent to const IsAgent = from === SharedFrom.Agent and update all references/usages in the file to `IsAgent` so imports/consumers still work; ensure any nearby JSX or logic that relies on `isAgent` is updated to the new identifier to avoid lint/type errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@web/src/pages/next-chats/share/index.tsx`:
- Line 47: Rename the constant `isAgent` to PascalCase (e.g., `IsAgent`) in this
module: change the declaration const isAgent = from === SharedFrom.Agent to
const IsAgent = from === SharedFrom.Agent and update all references/usages in
the file to `IsAgent` so imports/consumers still work; ensure any nearby JSX or
logic that relies on `isAgent` is updated to the new identifier to avoid
lint/type errors.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dc36935b-d31d-4447-a18b-3c65df8695b3
📒 Files selected for processing (2)
web/src/hooks/use-agent-request.tsweb/src/pages/next-chats/share/index.tsx
|
@euvre |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14190 +/- ##
=======================================
Coverage 95.30% 95.30%
=======================================
Files 10 10
Lines 703 703
Branches 112 112
=======================================
Hits 670 670
Misses 16 16
Partials 17 17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: noob <[email protected]>
…to skip-some-hint-in-shared-chat
What does this PR do?
Fixes the
hint : 103 Only owner of canvas authorized for this operationerror that appears when opening a Chat shared link (/chats/share?shared_id=...&from=chat).Root Cause
The Chat shared page (
web/src/pages/next-chats/share/index.tsx) unconditionally callsuseFetchFlowSSE(), which requests/api/canvas/getsse/{sharedId}. This is an Agent Canvas endpoint that validates canvas ownership. When sharing a Chat dialog (not an Agent):sharedIdis adialog_id, not acanvas_idtenant_iddoesn't match any canvas ownercode: 103, message: "Only owner of canvas authorized for this operation."request.tsdisplays it as a notification:hint : 103 Only owner of canvas authorized for this operation.Changes
web/src/hooks/use-agent-request.ts: Added anenabledparameter touseFetchFlowSSEso callers can conditionally skip the query.web/src/pages/next-chats/share/index.tsx: Only enableuseFetchFlowSSEwhenfrom === SharedFrom.Agent. For Chat shares, the hook is disabled, avoiding the unnecessary canvas API call entirely.Related Issue
Closes #14115
Type of change