Skip to content

feat: add SIWA feedback functionality to dashboard chat #7272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

Yash094
Copy link
Member

@Yash094 Yash094 commented Jun 4, 2025


PR-Codex overview

This PR focuses on enhancing the CustomChat functionality by introducing new message types and feedback mechanisms, while refactoring existing message handling to improve clarity and maintainability.

Detailed summary

  • Removed unused NebulaUserMessage and ChatMessage types.
  • Added UserMessage, UserMessageContent, and CustomChatMessage types.
  • Refactored state handling for messages from ChatMessage to CustomChatMessage.
  • Updated handleSendMessage to utilize new message types.
  • Introduced handleFeedback to submit user feedback on messages.
  • Replaced Chats component with CustomChats for improved message rendering.
  • Enhanced sendMessage prop in ChatBar to construct UserMessage.
  • Added feedback buttons for assistant messages with state management.
  • Created RenderMessage, RenderResponse, and StyledMarkdownRenderer components for better message display.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Introduced a new chat interface supporting multiple message types with distinct visual styles.
    • Enabled users to submit feedback (thumbs up/down) on assistant messages.
    • Enhanced chat experience with auto-scrolling that respects user interactions.
  • Bug Fixes

    • Prevented duplicate feedback submissions on assistant messages.

@Yash094 Yash094 requested review from a team as code owners June 4, 2025 12:04
Copy link

changeset-bot bot commented Jun 4, 2025

⚠️ No Changeset found

Latest commit: d4aed43

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jun 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2025 4:32pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) Jun 6, 2025 4:32pm
login ⬜️ Skipped (Inspect) Jun 6, 2025 4:32pm
thirdweb_playground ⬜️ Skipped (Inspect) Jun 6, 2025 4:32pm
wallet-ui ⬜️ Skipped (Inspect) Jun 6, 2025 4:32pm

Copy link
Contributor

coderabbitai bot commented Jun 4, 2025

"""

Walkthrough

A new CustomChats component and associated message types are introduced to replace the previous Chats implementation. The chat content logic is updated to use these new components and types, and a feedback mechanism is added, allowing users to rate assistant messages and submit feedback to a backend API.

Changes

File(s) Change Summary
.../components/CustomChat/CustomChatContent.tsx Replaces Chats with CustomChats, updates message types, changes handleSendMessage to use UserMessage, and adds a feedback handler for assistant messages.
.../components/CustomChat/CustomChats.tsx Introduces the new CustomChats component and CustomChatMessage type, implementing chat UI, message rendering by type, auto-scroll behavior, and feedback flow.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CustomChats
    participant CustomChatContent
    participant BackendAPI

    User->>CustomChats: Clicks feedback (thumbs up/down) on assistant message
    CustomChats->>CustomChatContent: Calls onFeedback callback with message, rating
    CustomChatContent->>BackendAPI: POST /v1/chat/feedback with feedback data
    BackendAPI-->>CustomChatContent: Returns success/failure
    CustomChatContent->>CustomChats: Updates message feedback state
    CustomChats-->>User: Disables feedback buttons, updates UI
Loading

Possibly related PRs

  • thirdweb-dev/js#7142: Removes feedback buttons and logic from the original Chats component, related to the reimplementation of feedback here in CustomChats.
  • thirdweb-dev/js#7197: Implements user feedback on assistant messages in a different chat component, related feature with similar feedback handling.
  • thirdweb-dev/js#7128: Adds feedback UI and teamId support to the original Chats component but does not replace it with CustomChats.

Suggested reviewers

  • joaquim-verges
    """

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

graphite-app bot commented Jun 4, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Jun 4, 2025
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.58%. Comparing base (f89c15c) to head (d4aed43).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7272   +/-   ##
=======================================
  Coverage   55.58%   55.58%           
=======================================
  Files         909      909           
  Lines       58670    58670           
  Branches     4158     4158           
=======================================
  Hits        32609    32609           
  Misses      25954    25954           
  Partials      107      107           
Flag Coverage Δ
packages 55.58% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@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: 5

🧹 Nitpick comments (2)
apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChats.tsx (1)

257-260: Consider showing feedback submission state to users.

Instead of hiding the buttons after feedback is submitted, consider showing a visual indicator that feedback was received (e.g., highlighting the selected option or showing a "Thank you" message).

apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChatContent.tsx (1)

212-212: Optimize useCallback dependencies.

Including messages in the dependency array causes the callback to be recreated on every message update. Since the function only needs the message at a specific index during execution, consider removing this dependency.

-    [sessionId, props.authToken, props.teamId, trackEvent, messages],
+    [sessionId, props.authToken, props.teamId, trackEvent],

Then access messages directly within the function using the functional setState pattern:

-      const message = messages[messageIndex];
+      // Get current message inside setState
+      setMessages((prev) => {
+        const message = prev[messageIndex];
+        // ... validation logic
+        return prev.map((msg, index) => 
+          index === messageIndex && msg.type === "assistant"
+            ? { ...msg, feedback }
+            : msg
+        );
+      });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b25d2af and 3f26cc3.

📒 Files selected for processing (2)
  • apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChatContent.tsx (5 hunks)
  • apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChats.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChats.tsx (1)

321-326: Excellent TypeScript exhaustiveness checking!

The use of never type ensures that all message types are handled at compile time, preventing runtime errors from unhandled cases.

Comment on lines +250 to +245
} catch (_e) {
// Handle error silently
} finally {
setIsSubmitting(false);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve error handling to provide user feedback.

Currently, errors during feedback submission are silently caught without notifying the user. Consider showing a toast notification or inline error message when feedback submission fails.

-    } catch (_e) {
-      // Handle error silently
+    } catch (error) {
+      console.error('Failed to submit feedback:', error);
+      // Consider showing user-facing error notification
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (_e) {
// Handle error silently
} finally {
setIsSubmitting(false);
}
} catch (error) {
console.error('Failed to submit feedback:', error);
// Consider showing user-facing error notification
} finally {
setIsSubmitting(false);
}
🤖 Prompt for AI Agents
In apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChats.tsx
around lines 250 to 254, the catch block for feedback submission errors is
empty, causing silent failures. Modify the catch block to capture the error and
display a user-friendly notification, such as a toast message or inline error,
informing the user that the feedback submission failed. This will improve user
experience by providing clear feedback on errors.

Comment on lines +207 to +212
console.error("Failed to send feedback:", error);
// Optionally show user-facing error notification
// Consider implementing retry logic here
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Provide user-facing feedback for errors.

Errors are only logged to console. Users should be notified when feedback submission fails.

Consider implementing a toast notification system or showing an inline error message to inform users when feedback submission fails. This improves the user experience by providing transparency about the operation status.

🤖 Prompt for AI Agents
In
apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChatContent.tsx
around lines 207 to 210, the code only logs errors to the console when feedback
submission fails, without notifying the user. To fix this, add a user-facing
error notification such as a toast message or an inline error display to inform
users about the failure. Integrate this notification within the existing error
handling block to improve user experience by providing clear feedback on the
operation status.

Copy link
Contributor

github-actions bot commented Jun 4, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.57 KB (0%) 1.3 s (0%) 268 ms (+200.24% 🔺) 1.6 s
thirdweb (cjs) 345.55 KB (0%) 7 s (0%) 656 ms (+8.18% 🔺) 7.6 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 82 ms (+1356.77% 🔺) 196 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 37 ms (+2212.19% 🔺) 48 ms
thirdweb/react (minimal + tree-shaking) 19.56 KB (0%) 392 ms (0%) 51 ms (+223.84% 🔺) 442 ms

Copy link
Member

@MananTank MananTank left a comment

Choose a reason for hiding this comment

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

Please remove Nebula types and icon from SIWA - check comments

@vercel vercel bot temporarily deployed to Preview – docs-v2 June 4, 2025 13:34 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 4, 2025 13:34 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 4, 2025 13:34 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 4, 2025 13:34 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 4, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 4, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 4, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 4, 2025 14:08 Inactive
@Yash094 Yash094 requested a review from MananTank June 4, 2025 20:42
Copy link
Member

@MananTank MananTank left a comment

Choose a reason for hiding this comment

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

Doesn't seem to be working

image

@vercel vercel bot temporarily deployed to Preview – docs-v2 June 5, 2025 07:18 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 5, 2025 07:18 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 5, 2025 07:18 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 5, 2025 07:18 Inactive
@Yash094 Yash094 requested a review from MananTank June 5, 2025 07:26
@MananTank MananTank added the merge-queue Adds the pull request to Graphite's merge queue. label Jun 6, 2025
Copy link
Member

MananTank commented Jun 6, 2025

Merge activity

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the `CustomChatContent` and `CustomChats` components to improve type safety and functionality in handling user messages and feedback. It introduces new types and methods for managing chat messages and feedback submission.

### Detailed summary
- Replaced `NebulaUserMessage` with `UserMessage` and `CustomChatMessage`.
- Added `handleFeedback` function for submitting feedback on messages.
- Updated `CustomChats` component to handle new message types and feedback.
- Modified `sendMessage` logic in `ChatBar` to use the new message structure.
- Introduced `RenderMessage` and `StyledMarkdownRenderer` for rendering chat messages.
- Added feedback buttons for assistant messages in `RenderMessage`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced a new chat interface supporting multiple message types with distinct visual styles.
  - Enabled users to submit feedback (thumbs up/down) on assistant messages.
  - Enhanced chat experience with auto-scrolling that respects user interactions.

- **Bug Fixes**
  - Prevented duplicate feedback submissions on assistant messages.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app bot force-pushed the yash/add-siwa-feedback branch from 8a2e633 to d4aed43 Compare June 6, 2025 16:24
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 6, 2025 16:24 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 6, 2025 16:24 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 6, 2025 16:24 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 6, 2025 16:24 Inactive
Copy link
Contributor

@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

♻️ Duplicate comments (2)
apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChats.tsx (2)

112-113: 🛠️ Refactor suggestion

Consider using a stable unique identifier instead of array index as key.

Using array index as the key can lead to React reconciliation issues if messages are reordered or deleted. Consider adding a unique id field to each message or generating a stable key based on message content and timestamp.


241-245: 🛠️ Refactor suggestion

Improve error handling to provide user feedback.

Currently, errors during feedback submission are silently caught without notifying the user. Consider showing a toast notification or inline error message when feedback submission fails.

- } catch (_e) {
-   // Handle error silently
+ } catch (error) {
+   console.error('Failed to submit feedback:', error);
+   // Consider showing user-facing error notification
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a2e633 and d4aed43.

📒 Files selected for processing (2)
  • apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChatContent.tsx (11 hunks)
  • apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChats.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChatContent.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChats.tsx (3)

14-36: Type definitions are well-structured and type-safe.

The discriminated union for CustomChatMessage provides excellent type safety, and the feedback type using 1 | -1 is appropriate for thumbs up/down ratings.


312-318: Excellent use of exhaustive type checking.

The default case with never type ensures TypeScript will catch any unhandled message types at compile time. This is a great pattern for maintaining type safety as the codebase evolves.


327-328: Good security practice with skipHtml.

Using skipHtml prevents potential XSS attacks through malicious HTML in markdown content, which is essential for user-generated content.

Comment on lines +156 to +157
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
<div className="flex justify-end" key={index}>
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Replace array index key with stable identifier.

Similar to the main messages loop, using array index as key for user message content can cause reconciliation issues.

- // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
- <div className="flex justify-end" key={index}>
+ <div className="flex justify-end" key={`${index}-${msg.text.slice(0, 50)}`}>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
<div className="flex justify-end" key={index}>
<div className="flex justify-end" key={`${index}-${msg.text.slice(0, 50)}`}>
🤖 Prompt for AI Agents
In apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChats.tsx
at lines 156-157, replace the use of the array index as the key in the user
message content div with a stable and unique identifier from the message data,
such as a message ID or timestamp, to avoid reconciliation issues during
rendering.

Comment on lines +67 to +87
useEffect(() => {
if (!enableAutoScroll) {
return;
}

const chatScrollContainer =
chatContainerRef.current?.querySelector("[data-scrollable]");

if (!chatScrollContainer) {
return;
}

const disableScroll = () => {
setEnableAutoScroll(false);
chatScrollContainer.removeEventListener("mousedown", disableScroll);
chatScrollContainer.removeEventListener("wheel", disableScroll);
};

chatScrollContainer.addEventListener("mousedown", disableScroll);
chatScrollContainer.addEventListener("wheel", disableScroll);
}, [setEnableAutoScroll, enableAutoScroll]);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add cleanup for event listeners to prevent memory leaks.

The useEffect adds event listeners but doesn't clean them up when the component unmounts or when dependencies change, which can cause memory leaks.

// eslint-disable-next-line no-restricted-syntax
useEffect(() => {
  if (!enableAutoScroll) {
    return;
  }

  const chatScrollContainer =
    chatContainerRef.current?.querySelector("[data-scrollable]");

  if (!chatScrollContainer) {
    return;
  }

  const disableScroll = () => {
    setEnableAutoScroll(false);
-   chatScrollContainer.removeEventListener("mousedown", disableScroll);
-   chatScrollContainer.removeEventListener("wheel", disableScroll);
  };

  chatScrollContainer.addEventListener("mousedown", disableScroll);
  chatScrollContainer.addEventListener("wheel", disableScroll);
+
+ return () => {
+   chatScrollContainer.removeEventListener("mousedown", disableScroll);
+   chatScrollContainer.removeEventListener("wheel", disableScroll);
+ };
}, [setEnableAutoScroll, enableAutoScroll]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
if (!enableAutoScroll) {
return;
}
const chatScrollContainer =
chatContainerRef.current?.querySelector("[data-scrollable]");
if (!chatScrollContainer) {
return;
}
const disableScroll = () => {
setEnableAutoScroll(false);
chatScrollContainer.removeEventListener("mousedown", disableScroll);
chatScrollContainer.removeEventListener("wheel", disableScroll);
};
chatScrollContainer.addEventListener("mousedown", disableScroll);
chatScrollContainer.addEventListener("wheel", disableScroll);
}, [setEnableAutoScroll, enableAutoScroll]);
useEffect(() => {
if (!enableAutoScroll) {
return;
}
const chatScrollContainer =
chatContainerRef.current?.querySelector("[data-scrollable]");
if (!chatScrollContainer) {
return;
}
const disableScroll = () => {
setEnableAutoScroll(false);
};
chatScrollContainer.addEventListener("mousedown", disableScroll);
chatScrollContainer.addEventListener("wheel", disableScroll);
return () => {
chatScrollContainer.removeEventListener("mousedown", disableScroll);
chatScrollContainer.removeEventListener("wheel", disableScroll);
};
}, [setEnableAutoScroll, enableAutoScroll]);
🤖 Prompt for AI Agents
In apps/dashboard/src/app/nebula-app/(app)/components/CustomChat/CustomChats.tsx
around lines 67 to 87, the useEffect adds event listeners to chatScrollContainer
but does not remove them on cleanup, risking memory leaks. Fix this by returning
a cleanup function from the useEffect that removes the "mousedown" and "wheel"
event listeners from chatScrollContainer when the component unmounts or
dependencies change.

@graphite-app graphite-app bot merged commit d4aed43 into main Jun 6, 2025
24 checks passed
@graphite-app graphite-app bot removed the merge-queue Adds the pull request to Graphite's merge queue. label Jun 6, 2025
@graphite-app graphite-app bot deleted the yash/add-siwa-feedback branch June 6, 2025 16:33
@vercel vercel bot temporarily deployed to Production – login June 6, 2025 16:33 Inactive
@vercel vercel bot temporarily deployed to Production – thirdweb_playground June 6, 2025 16:33 Inactive
@vercel vercel bot temporarily deployed to Production – wallet-ui June 6, 2025 16:33 Inactive
@vercel vercel bot temporarily deployed to Production – docs-v2 June 6, 2025 16:33 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants