Skip to content

mention click change to chat tab#2243

Merged
simo6529 merged 4 commits intomainfrom
mention-click-switch-to-chat
Apr 10, 2026
Merged

mention click change to chat tab#2243
simo6529 merged 4 commits intomainfrom
mention-click-switch-to-chat

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Apr 9, 2026

Summary by CodeRabbit

  • New Features

    • URL params can temporarily override active tabs for deep links.
    • Introduced transient (non-persistent) tab selections that persist for the same wave but clear on wave change.
    • Waves with a serial target can auto-switch gallery view to chat when appropriate.
  • Bug Fixes

    • Query-parameter handling refined to avoid unintended redirects, stale drop state, or improper tab persistence.
  • Tests

    • Expanded coverage for transient tab behavior, URL-driven tab/gallery interactions, and view-mode transitions.

Signed-off-by: Simo <simo@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 05ddda96-d2d6-4fd2-b45e-cca32447b989

📥 Commits

Reviewing files that changed from the base of the PR and between 2e0ef25 and 451a01d.

📒 Files selected for processing (1)
  • components/brain/ContentTabContext.tsx

📝 Walkthrough

Walkthrough

Adds a transient per-wave tab override to ContentTabContext (set via URL or non-persisted API), extends setActiveContentTab with a persist option, wires URL-driven transient preference into MyStreamWaveDesktopTabs and MyStreamWave view-mode logic, and expands tests to cover transient vs persisted behaviors.

Changes

Cohort / File(s) Summary
ContentTabContext
components/brain/ContentTabContext.tsx
Added transientPreferredTab to WaveTabParams, transientTabOverrideRef, new SetActiveContentTabOptions/SetActiveContentTab types, and updated setActiveContentTab(tab, { persist?: boolean }) to apply transient overrides, persist when appropriate, and clear overrides on wave change or invalid tab.
MyStreamWaveDesktopTabs
components/brain/my-stream/MyStreamWaveDesktopTabs.tsx
Reads serialNo via useSearchParams, changed setActiveTab prop type to SetActiveContentTab, removed unconditional chat-switch, and passes transientPreferredTab into updateAvailableTabs when serialNo is present.
MyStreamWave / Chat components
components/brain/my-stream/MyStreamWave.tsx, components/brain/my-stream/MyStreamWaveChat.tsx
Added effect to force viewMode from gallerychat when serialNo is present and gallery toggle applies; adjusted query-param clearing effect to depend on viewMode and pathname.
Tests — ContentTabContext
__tests__/components/brain/ContentTabContext.test.tsx
Clears localStorage before each test; added tests covering transientPreferredTab, non-persistence via persist:false, retention across same-wave recalculations, clearing on wave change, and related fallback behavior.
Tests — MyStreamWaveDesktopTabs
__tests__/components/brain/my-stream/MyStreamWaveDesktopTabs.test.tsx
Mocks useSearchParams with controllable getter, removes setActiveContentTab from context mock, and adds test asserting serialNo causes updateAvailableTabs({ transientPreferredTab: CHAT }) without calling setActiveTab.
Tests — MyStreamWave / Chat
__tests__/components/brain/my-stream/MyStreamWave.test.tsx, __tests__/components/brain/my-stream/MyStreamWaveChat.test.tsx
Mocks useWaveViewMode; adds tests ensuring gallery→chat enforcement when serialNo present on eligible waves and that router replace/initialDrop behavior occurs appropriately when switching into chat view.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Tabs as MyStreamWaveDesktopTabs
    participant Nav as useSearchParams
    participant Context as ContentTabContext

    User->>Tabs: Open wave URL with ?serialNo=42
    Tabs->>Nav: read serialNo
    Nav-->>Tabs: "42"
    Tabs->>Context: updateAvailableTabs({waveId, isChatWave, transientPreferredTab: CHAT})
    Context->>Context: transientTabOverrideRef = CHAT
    Context-->>Tabs: availableTabs + activeContentTab = CHAT (transient)
    Tabs->>User: render with CHAT active

    User->>Tabs: Navigate to different wave
    Tabs->>Context: updateAvailableTabs({waveId: different, transientPreferredTab: null})
    Context->>Context: clear transientTabOverrideRef
    Context-->>Tabs: activeContentTab = stored/default for new wave
    Tabs->>User: render with stored/default tab
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Leaderboard as first tab and default #1869: Modified updateAvailableTabs and default tab selection in ContentTabContext — closely related to transientPreferredTab handling.
  • Unread divider fix #1688: Adjusted MyStreamWaveChat/MyStreamWave serialNo/divider query-param behavior — related to view-mode and query-param handling.
  • persist last opened tab #1898: Added per-wave persisted tab storage in ContentTabContext — this PR builds a transient override layer on top of that logic.

Suggested reviewers

  • prxt6529
  • ragnep

Poem

🐰 I hopped through tabs with a curious pat,

A carrot-flag set just for a chat,
It stays for a moment, not a forever-trace,
Then bounces off—leaving the stored place,
Hooray for transient hops and tidy space.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'mention click change to chat tab' is vague and generic, using non-descriptive phrasing that doesn't clearly convey what the changeset accomplishes. While 'chat tab' appears in multiple files, the title doesn't explain the core feature: implementing transient tab preferences driven by URL parameters. Revise the title to be more specific and descriptive, such as: 'Add transient tab preference system for URL-driven tab selection' or 'Implement serialNo query parameter to control chat tab focus'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 mention-click-switch-to-chat

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 and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4404540efc

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread __tests__/components/brain/my-stream/MyStreamWaveDesktopTabs.test.tsx Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@__tests__/components/brain/my-stream/MyStreamWaveDesktopTabs.test.tsx`:
- Around line 252-263: The test incorrectly asserts setActiveTab(...) for the
serialNo-driven automatic switch, but the component uses
updateAvailableTabs(...) with transientPreferredTab to perform that transient
switch; update the test in MyStreamWaveDesktopTabs.test.tsx so that after
mocking searchParamsGet to return "42" and rendering the component you assert
updateAvailableTabs was called with an object containing transientPreferredTab:
MyStreamWaveTab.CHAT (and remove or adjust the setActiveTab expectation),
referencing the mockAvailableTabs, searchParamsGet, updateAvailableTabs, and
MyStreamWaveTab symbols used in the test.

In `@components/brain/my-stream/MyStreamWaveDesktopTabs.tsx`:
- Around line 8-12: The SetActiveContentTab type declares an optional second
parameter { persist?: boolean } but this component (MyStreamWaveDesktopTabs)
never passes it to setActiveTab; either use the persistence flag when switching
tabs or remove/adjust the type. Fix by updating the two setActiveTab calls in
MyStreamWaveDesktopTabs to pass the appropriate options object (e.g.,
setActiveTab(tabKey, { persist: true }) or { persist: false }) based on the
intended behavior (for example driven by WaveVotingState from useContentTab or a
local transient flag), or if persistence isn’t needed here, change the prop type
annotation to a SetActiveContentTab signature without the options parameter so
the API and usage match.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0f71823f-a61b-4bc1-b0c7-6619b1dc4809

📥 Commits

Reviewing files that changed from the base of the PR and between 32c6189 and 4404540.

📒 Files selected for processing (4)
  • __tests__/components/brain/ContentTabContext.test.tsx
  • __tests__/components/brain/my-stream/MyStreamWaveDesktopTabs.test.tsx
  • components/brain/ContentTabContext.tsx
  • components/brain/my-stream/MyStreamWaveDesktopTabs.tsx

Comment thread components/brain/my-stream/MyStreamWaveDesktopTabs.tsx
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/brain/my-stream/MyStreamWave.tsx`:
- Line 3: The code currently calls setViewMode("chat") when a serialNo deep-link
is present, which mutates persisted view-mode; instead remove those setViewMode
calls (wherever you see setViewMode("chat") around the serialNo handling) and
compute a transient effective mode inside render/useMemo (e.g., const
effectiveViewMode = serialNo ? "chat" : viewMode) and use effectiveViewMode for
conditional rendering, class names, and logic; apply this change for the
occurrences around the serialNo handling mentioned (the setViewMode calls in the
blocks referenced at ~lines 85-105, 130-131, and 160-161) so the persisted
viewMode is not mutated.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fd871611-cb2a-499a-a701-ec0425494a2a

📥 Commits

Reviewing files that changed from the base of the PR and between 4404540 and 2e0ef25.

📒 Files selected for processing (5)
  • __tests__/components/brain/my-stream/MyStreamWave.test.tsx
  • __tests__/components/brain/my-stream/MyStreamWaveChat.test.tsx
  • __tests__/components/brain/my-stream/MyStreamWaveDesktopTabs.test.tsx
  • components/brain/my-stream/MyStreamWave.tsx
  • components/brain/my-stream/MyStreamWaveChat.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/components/brain/my-stream/MyStreamWaveDesktopTabs.test.tsx

Comment thread components/brain/my-stream/MyStreamWave.tsx
Signed-off-by: Simo <simo@6529.io>
@sonarqubecloud
Copy link
Copy Markdown

@simo6529 simo6529 merged commit adc3db9 into main Apr 10, 2026
8 checks passed
@simo6529 simo6529 deleted the mention-click-switch-to-chat branch April 10, 2026 08:47
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