-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor: useScroll hook #376
Conversation
Reviewer's Guide by SourceryThis pull request refactors the scrolling logic using a new Sequence diagram for smoothScrollToBottom functionsequenceDiagram
participant Component
participant useScroll Hook
participant containerRef.current
Component->>useScroll Hook: Calls smoothScrollToBottom()
useScroll Hook->>containerRef.current: scrollTo(top: maxScrollTop - 1, behavior: scrollBehavior)
activate containerRef.current
deactivate containerRef.current
useScroll Hook->>containerRef.current: requestAnimationFrame()
useScroll Hook->>containerRef.current: scrollTo(top: maxScrollTop, behavior: scrollBehavior)
activate containerRef.current
deactivate containerRef.current
Sequence diagram for scrollToTop functionsequenceDiagram
participant Component
participant useScroll Hook
participant threadRef.current
Component->>useScroll Hook: Calls scrollToTop()
useScroll Hook->>useScroll Hook: setTimeout(scrollDelay)
useScroll Hook->>threadRef.current: scrollIntoView(behavior: scrollBehavior, block: 'start')
activate threadRef.current
deactivate threadRef.current
Updated class diagram for the useScroll hookclassDiagram
class useScroll {
-containerRef: RefObject<HTMLElement>
-threadRef: RefObject<HTMLElement>
-isNewContent: boolean
-hasMore: boolean
-isLast: boolean
-loading: boolean
-loadMore: () => void
-rootMargin?: string
-threshold?: number
-scrollBehavior?: ScrollBehavior
-scrollDelay?: number
-isNearBottom: boolean
+smoothScrollToBottom(): void
+scrollToTop(): void
}
note for useScroll "Replaces useAtBottom, provides smooth scrolling, bottom detection, and infinite scroll handling with improved error handling and debouncing."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe pull request introduces a refactor of the scrolling functionality across chat and thread components. The Changes
Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
apps/masterbots.ai/lib/hooks/use-debounce.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct. The config "next/core-web-vitals" was referenced from the config file in "/apps/masterbots.ai/.eslintrc.json". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. apps/masterbots.ai/components/routes/thread/thread-component.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct. The config "next/core-web-vitals" was referenced from the config file in "/apps/masterbots.ai/.eslintrc.json". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. apps/masterbots.ai/components/routes/chat/chat.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct. The config "next/core-web-vitals" was referenced from the config file in "/apps/masterbots.ai/.eslintrc.json". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Bran18 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a comment explaining why you're using requestAnimationFrame in
smoothScrollToBottom
. - The try/catch blocks in
useScroll
are a good addition, but consider adding more specific error handling or logging.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (13)
apps/masterbots.ai/lib/hooks/use-scroll.tsx (6)
13-14
: Document the new optional scroll props.
These props are helpful for controlling the scroll, but please consider adding doc comments or usage examples forscrollBehavior
andscrollDelay
so that other developers can discover and use them effectively.
36-66
: Consider simplifying the two-phase scrolling approach.
While splitting the scroll into two phases (with arequestAnimationFrame
in between) may ensure a slightly smoother final scroll, you might explore a single animated call or built-inscrollIntoView
for consistency. If the container’s height changes between phases, the final scroll position could shift unexpectedly.
69-84
: Consider consistency in animation approach.
Using a Promise-basedsetTimeout
forscrollToTop
while usingrequestAnimationFrame
insmoothScrollToBottom
can yield slightly different user experiences. For consistency, unify these approaches or at least document the difference.
86-125
: Add fallback for unsupported IntersectionObserver.
This bottom observer logic is robust and includes thorough cleanup, but you may want a fallback for older browsers that lack IntersectionObserver support. This ensures a seamless experience for a broader audience.
134-172
: Reusable infinite scroll threshold and margin.
Your infinite scroll logic is well-structured and debounced. For maximum flexibility, consider makingrootMargin
andthreshold
configurable, enabling different pagination or layout strategies.
174-179
: Optionally expose additional observer states.
Returning references or observer states in the hook can aid advanced debugging or custom behaviors while still keeping your default usage simple.apps/masterbots.ai/lib/hooks/use-thread.tsx (2)
20-20
: Clarify usage ofisAtBottomOfSection
.
If this new boolean is conceptually similar toisAtBottom
, consider renaming or better differentiating them to make the flow and purpose clearer.
88-96
: Check consistent usage ofisNearBottom
andisAtBottomOfSection
.
Maintaining two separate booleans might become confusing if their purposes overlap. Consider merging or providing clear documentation if they serve distinct needs.apps/masterbots.ai/components/routes/thread/thread-popup.tsx (3)
29-37
: Specify optionaluseScroll
properties if needed.
If you plan to adjust behaviors like scroll speed or delay, explicitly setscrollBehavior
andscrollDelay
inuseScroll
to avoid confusion about default values.
53-53
: Check effect dependencies for performance.
IncludingsmoothScrollToBottom
in the dependency array can re-run the effect if the function isn’t memoized. Even if it’s stable, confirm it won’t cause excessive re-renders.
107-138
: Efficient conditional rendering for browse vs. chat view.
This pattern is clear, but you could extract shared logic if the two views have overlapping layout needs. That can further reduce duplication and ease maintenance.apps/masterbots.ai/components/routes/chat/chat.tsx (2)
81-89
: Implement infinite scroll functionality.The TODO comments indicate plans to implement infinite scroll. I can help with the implementation.
Would you like me to:
- Generate the implementation for the
loadMore
callback?- Open a new issue to track this enhancement?
92-102
: Replaceany
type withNodeJS.Timeout
.The
any
type can be replaced with a more specific type for better type safety.-// biome-ignore lint/suspicious/noExplicitAny: <explanation> -let timeoutId: any +let timeoutId: NodeJS.Timeout | undefined
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
apps/masterbots.ai/components/routes/chat/chat.tsx
(4 hunks)apps/masterbots.ai/components/routes/thread/thread-popup.tsx
(2 hunks)apps/masterbots.ai/lib/context/thread-context.tsx
(1 hunks)apps/masterbots.ai/lib/hooks/use-scroll.tsx
(3 hunks)apps/masterbots.ai/lib/hooks/use-thread.tsx
(6 hunks)apps/masterbots.ai/types/types.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- apps/masterbots.ai/lib/context/thread-context.tsx
🔇 Additional comments (21)
apps/masterbots.ai/lib/hooks/use-scroll.tsx (4)
27-28
: Consider boundary checks forscrollDelay
.
Setting a default of300ms
is sensible, but it might be beneficial to guard against zero or negative values if that scenario comes up. Consider throwing a warning or falling back to a sane default when negative values are passed.
31-33
: Good usage of separate refs for observer, dummy element, and timeout.
This approach helps keep each reference isolated and improves clarity around resource cleanup.
35-35
: Helpful comment on memoization.
This clarifies why we’re using memoized callbacks for scroll handlers and avoids unnecessary renders.
127-133
: Potential repeated triggers for new content.
CallingsmoothScrollToBottom()
wheneverisNewContent
is true andisNearBottom
can lead to multiple scroll calls if content arrives in quick succession. Consider debouncing or verifying the container is truly out of sync before scrolling.apps/masterbots.ai/lib/hooks/use-thread.tsx (5)
11-11
: Nice integration ofuseScroll
.
ImportinguseScroll
helps centralize and unify scrolling logic while reducing duplicated code across hooks.
18-18
: Ref-based approach forsectionRef
.
Switching toReact.RefObject<HTMLElement>
provides more robust type safety and aligns well with theuseScroll
hook.
84-85
: Initialize refs for container and thread with null default.
Usingnull
initialization is standard practice and matches the updates inuseScroll
, ensuring consistent behavior across the codebase.
108-108
: Confirm effect dependencies.
Verify that all variables or states referenced inside the effect are in the dependency array, ensuring no stale references or missed updates.
169-170
: Re-mapisNearBottom
toisAtBottom
carefully.
Renaming or re-mapping variables might confuse existing references. Ensure any external usage is updated for consistency and backward compatibility.apps/masterbots.ai/components/routes/thread/thread-popup.tsx (8)
18-18
: ConsistentuseScroll
import.
Centralizing scroll logic extracts complexity from the component, minimizing custom code.
25-26
: Use null default for popup and thread refs.
Initializing refs tonull
is the recommended practice in React for clarity and strict type compatibility.
41-41
: Conditional check for container reference is good.
Safely verifyingpopupContentRef.current
before scrolling avoids possible null pointer issues.
45-45
: Clear comment labeling updated effect.
Indicating “Update effect to use smoothScrollToBottom” helps future maintainers trace the rationale for your improvements.
49-49
: Smooth scrolling on load.
TriggeringsmoothScrollToBottom()
after a slight delay is a neat UX touch, ensuring users see newly loaded content immediately.
98-98
: Properly attachingpopupContentRef
.
Assigning this ref to the scrolling container ensures theuseScroll
hook can manage and observe the correct element.
102-102
: Conditional container height logic.
Differentiatingmax-height
for browse vs chat mode is a clean approach to accommodate distinct layouts.
106-106
:threadRef
for nested content.
Providing a separate ref for the thread region helps isolate infinite scroll or other thread-specific logic from the main container.apps/masterbots.ai/components/routes/chat/chat.tsx (3)
42-42
: LGTM! Improved type safety with explicit ref initialization.The explicit
null
initialization for refs is safer than leaving themundefined
.Also applies to: 48-48, 70-71
104-114
: LGTM! Improved type safety and scroll behavior.The function correctly handles both thread and container refs, with improved type safety through explicit typing.
166-168
: LGTM! Consistent scroll behavior implementation.The changes correctly implement the new scroll behavior using
isNearBottom
from theuseScroll
hook.Also applies to: 171-173, 198-203
apps/masterbots.ai/types/types.ts (1)
38-38
: LGTM! Type definition aligns with component changes.The optional
scrollToBottomOfPopup
method is correctly typed and aligns with the Chat component's new scroll behavior.
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/masterbots.ai/components/routes/thread/thread-popup.tsx
(2 hunks)
🔇 Additional comments (4)
apps/masterbots.ai/components/routes/thread/thread-popup.tsx (4)
12-12
: LGTM! Import changes are well-organized.The new imports support the refactored scroll functionality.
Also applies to: 18-18
25-26
: LGTM! Refs are properly initialized.The explicit null initialization improves type safety.
97-140
: LGTM! Component structure is well-organized.The conditional rendering and ref placement are properly implemented, with clear separation between browse and chat views.
29-37
:❓ Verification inconclusive
Verify if loadMore callback is intentionally empty.
The
loadMore
callback is set to an empty function. Please confirm if this is intentional or if pagination should be implemented.
🏁 Script executed:
#!/bin/bash # Search for other usages of loadMore in useScroll to understand the expected implementation rg -A 5 "loadMore.*useScroll"Length of output: 31
Action Required: Reconfirm Intentional Empty
loadMore
Callback
- In
apps/masterbots.ai/components/routes/thread/thread-popup.tsx
, theuseScroll
hook is configured withloadMore: () => {}
.- A search for additional occurrences of
loadMore
in connection withuseScroll
did not return any results.- Please verify if using an empty function is intentional (e.g., pagination isn’t required given
hasMore: false
andisLast: true
) or if a proper pagination implementation should be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I left the sourcery-ai and coderabbitai that we can take before the merge 👍 it would be good to check if it will trigger, maybe adding the ref directly to the ChatList component instead of a wrapper (where the scrollbar is) so it can read his position of the scrollable container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
apps/masterbots.ai/components/routes/chat/chat-accordion.tsx (1)
82-99
: 💡 Verification agent🧩 Analysis chain
Consider integrating with scroll behavior.
Given the PR's focus on scroll behavior refactoring, consider integrating with the new
useScroll
hook to ensure proper scroll behavior when toggling threads, especially when:
- Opening a thread that might need to scroll to show new content
- Closing a thread that might require repositioning the view
Let's verify if the
useScroll
hook is available and how it's being used in other components:
🏁 Script executed:
#!/bin/bash # Search for useScroll hook implementation and usage rg -A 5 "useScroll" --type ts --type tsxLength of output: 68
Let's re-run the search command with explicit glob patterns to ensure that both TS and TSX files are searched. Please execute the following script:
🏁 Script executed:
[run_scripts] #!/bin/bash # Properly search for the useScroll hook in all TS and TSX files using explicit glob patterns. rg "useScroll" --glob "*.ts" --glob "*.tsx" -A 5Length of output: 5885
Integrate the useScroll Hook for Consistent Scroll Behavior
The current toggle function in
apps/masterbots.ai/components/routes/chat/chat-accordion.tsx
(lines 82–99) manages thread state changes correctly but doesn’t adjust the scroll position. Since the PR focuses on scroll behavior refactoring, please integrate the newuseScroll
hook here. This integration should ensure that:
- When opening a thread: The view scrolls appropriately (for example, by invoking a function like
smoothScrollToBottom
) to display the new content.- When closing a thread: The view is repositioned as needed (possibly by using
scrollToTop
or another appropriate function).For guidance, you can refer to how
useScroll
is used in other parts of the codebase:
apps/masterbots.ai/components/routes/chat/chat.tsx
apps/masterbots.ai/components/routes/chat/chat-list.tsx
apps/masterbots.ai/components/routes/thread/thread-component.tsx
Please update the toggle function accordingly to align with the scroll refactoring objectives.
🧹 Nitpick comments (4)
apps/masterbots.ai/lib/hooks/use-scroll.tsx (3)
3-3
: Address the TODO comment.The comment suggests renaming the hook. Consider addressing this task to maintain clear and consistent naming across the codebase.
Would you like me to suggest alternative names or create an issue to track this task?
61-67
: Consider using more specific error types.While the error handling is good, consider using more specific error types to better handle different failure scenarios.
- } catch (error) { + } catch (error: unknown) { + if (error instanceof DOMException) { + console.error('DOM operation failed during smooth scroll:', error) + } else { console.error('Error during smooth scroll:', error) + } // Fallback to instant scroll if smooth scroll fails if (containerRef.current) { containerRef.current.scrollTop = maxScrollTop } }
171-173
: Consider using more specific error types for infinite scroll observer.Similar to the scroll handlers, consider using more specific error types for better error handling.
- } catch (error) { + } catch (error: unknown) { + if (error instanceof DOMException) { + console.error('DOM operation failed during infinite scroll setup:', error) + } else { console.error('Error setting up infinite scroll observer:', error) + } }apps/masterbots.ai/components/routes/chat/chat-accordion.tsx (1)
27-28
: Remove unnecessary empty lines.These empty lines don't enhance readability and should be removed to maintain a consistent code style.
children: React.ReactNode[] - - defaultState?: boolean - - triggerClass?: stringAlso applies to: 30-31
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/masterbots.ai/components/routes/chat/chat-accordion.tsx
(1 hunks)apps/masterbots.ai/lib/hooks/use-scroll.tsx
(3 hunks)
🔇 Additional comments (5)
apps/masterbots.ai/lib/hooks/use-scroll.tsx (5)
15-16
: LGTM! Good addition of scroll customization options.The new optional parameters
scrollBehavior
andscrollDelay
with sensible defaults enhance the hook's flexibility while maintaining backward compatibility.Also applies to: 29-30
32-35
: LGTM! Well-structured ref declarations.The new refs are properly typed and will help manage cleanup of observers and timeouts effectively.
88-127
: Consider extracting observer logic into a separate hook.The observer setup logic could be extracted into a reusable hook as previously suggested.
129-134
: LGTM! Clean and focused effect.The effect has clear conditions and proper dependency list.
176-181
: LGTM! Clean and focused return value.The hook returns exactly what's needed with no unnecessary values.
Previews: Screen.Recording.2025-02-15.at.12.47.11.PM.movScreen.Recording.2025-02-15.at.12.47.41.PM.mov |
There was a problem hiding this 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
🧹 Nitpick comments (8)
apps/masterbots.ai/lib/hooks/use-mb-scroll.tsx (3)
5-17
: Consider documenting each option inUseScrollOptions
.While the interface is clear and self-explanatory, adding short JSDoc (or TSDoc) comments for each property would make it more approachable for other developers and enhance maintainability.
57-70
: Maintain a single IntersectionObserver if usage is lightweight.Having a dedicated observer for bottom detection and another for infinite scrolling is valid. However, if performance or memory usage ever becomes a concern, consider combining both use cases within a single observer — e.g., monitoring one sentinel element for bottom detection and load-more logic.
117-133
: Optional fallback for delayed scroll to top.The code uses a delay before scrolling to the top, which is helpful for certain animations or transitions. If different components require unique timings, consider making this logic more flexible by allowing users to pass a dynamic delay or skip it.
apps/masterbots.ai/lib/hooks/use-debounce.tsx (1)
4-9
: Consider exposing a way to cancel or flush the debounced callback.The current implementation only provides a debounced version of the original callback. Some use cases may require cancellation or immediate invocation. Providing utility methods for these actions could make the hook more robust.
apps/masterbots.ai/lib/hooks/use-intersection-observer.tsx (2)
3-10
: Add brief docs on when and why to enable or disable this observer.The
enabled
flag is useful for conditionally activating observation. Provide a quick comment or doc snippet to clarify its intended usage, such as deferring setup or toggling large cost operations.
20-25
: Expose more intersection details if needed.Currently, you only forward
entry.isIntersecting
toonIntersect
. If advanced scenarios (e.g., retrieving an intersection ratio for partial intersections) arise, consider extending the callback to provide the fullIntersectionObserverEntry
.apps/masterbots.ai/lib/hooks/use-thread.tsx (1)
98-99
: Add explanations for biome-ignore comments.The biome-ignore comments should include explanations for why the exhaustive dependencies are not required.
-// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation> +// biome-ignore lint/correctness/useExhaustiveDependencies: setState is stable and doesn't need to be includedAlso applies to: 130-131
apps/masterbots.ai/components/routes/chat/chat-list.tsx (1)
56-61
: Consider memoizing sorted messages for better performance.Sorting messages on every render could impact performance with large message lists.
Consider memoizing the sorted messages:
-const chatMessages = (messages || activeThread?.messages || []).sort( - (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime() -) -const previousChatMessages = (activeThread?.thread?.messages || []).sort( - (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime() -) +const chatMessages = React.useMemo(() => { + const msgs = messages || activeThread?.messages || [] + return [...msgs].sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()) +}, [messages, activeThread?.messages]) + +const previousChatMessages = React.useMemo(() => { + const msgs = activeThread?.thread?.messages || [] + return [...msgs].sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()) +}, [activeThread?.thread?.messages])
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockb
is excluded by!**/bun.lockb
📒 Files selected for processing (9)
apps/masterbots.ai/components/routes/chat/chat-list.tsx
(13 hunks)apps/masterbots.ai/components/routes/chat/chat.tsx
(4 hunks)apps/masterbots.ai/components/routes/thread/thread-component.tsx
(4 hunks)apps/masterbots.ai/components/routes/thread/thread-popup.tsx
(3 hunks)apps/masterbots.ai/lib/hooks/use-debounce.tsx
(1 hunks)apps/masterbots.ai/lib/hooks/use-intersection-observer.tsx
(1 hunks)apps/masterbots.ai/lib/hooks/use-mb-scroll.tsx
(1 hunks)apps/masterbots.ai/lib/hooks/use-scroll.tsx
(0 hunks)apps/masterbots.ai/lib/hooks/use-thread.tsx
(6 hunks)
💤 Files with no reviewable changes (1)
- apps/masterbots.ai/lib/hooks/use-scroll.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/masterbots.ai/components/routes/thread/thread-popup.tsx
🔇 Additional comments (8)
apps/masterbots.ai/lib/hooks/use-mb-scroll.tsx (3)
36-55
: Validate SSR safety and browser support.Creating and appending a dummy DOM element directly in
useEffect
is fine for standard browsers but might need defensive checks or fallbacks for SSR scenarios (e.g., Next.js) or older browsers that lack certain APIs.
86-115
: Double-phase scrolling approach is clever but verify container dimension changes.Using
requestAnimationFrame
for the second phase is a neat way to ensure the scroller gets reliably to the bottom. However, if the container’s height changes after the first phase (e.g., images loading), the final scroll position could be off. Consider verifying or re-checking the container height before the second scroll call.
135-141
: Auto-scroll only if user remains near bottom.The approach of automatically scrolling down whenever new content arrives is good. Ensure you confirm that a user who manually scrolled away from the bottom is not forced down unintentionally. Currently,
isNearBottom
covers this case, but if you introduce advanced logic (like partial offset checks), you may need further refinement.apps/masterbots.ai/lib/hooks/use-debounce.tsx (1)
20-32
: Include dependency array usage in your callback.You accept a
deps
parameter, but it’s only partially used. If dependencies change, you might want to re-instantiate or reconfigure the debounce timer. Currently, you rely mostly on[callback, delay]
. Consider clarifying or removingdeps
if not fully supported.apps/masterbots.ai/components/routes/thread/thread-component.tsx (1)
10-10
: LGTM! Clean implementation of the new scroll hook.The changes successfully integrate the new
useMBScroll
hook, maintaining consistency with the PR's objective of refactoring scroll logic.Also applies to: 35-43, 105-105
apps/masterbots.ai/lib/hooks/use-thread.tsx (1)
18-19
: LGTM! Improved type safety with strict ref types.The changes from
MutableRefObject<HTMLElement | undefined>
toRefObject<HTMLElement>
and initializing refs withnull
improve type safety.Also applies to: 84-85
apps/masterbots.ai/components/routes/chat/chat.tsx (1)
81-89
: LGTM! Clean implementation of the scroll hook.The
useMBScroll
hook is well-integrated with appropriate parameters for managing scroll behavior.apps/masterbots.ai/components/routes/chat/chat-list.tsx (1)
49-54
: LGTM! Clean ref management implementation.The conditional ref handling with
effectiveContainerRef
andeffectiveThreadRef
is well-structured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for dealing the scrolling regression issue. This version is good for test and as the changes, this should work by hearing the bottom scrolling area. merging!
* devops: force deploy * devops: trigger automated build * devops: trigger automated build * devops: trigger automated build * devops: trigger automated build * devops: trigger automated build * devops: trigger automated build * devops: trigger automated build * impr(masterbots.ai): add return to browse on bot thread page view (#204) * ✨ Added back button to thread details page * ⚡️ changed char to svg * feat: ai gen 404 image for custom 404 error page (#210) * ⚡️ added custom error page * ⚡️ clean up * fix(masterbots.ai): terms page visibility and access * feat(masterbots.ai): consistent og image style design and dynamic metadata (#215) * feat: added og api endpoint * feat: design og image for dark mode * fix: file formated * fix: amend og image to pick current theme color and adapt * feat: added custom metadata to thread page * feat: added custom metadata to bot page * fix: clean up * fix: move bg to a component * fix: move og-image design to a component * fix: use variable for URL * fix: to slug func * ⚡️ Move and clean up UrlToSlug * fix(masterbots.ai): zod dependecy * fix: type error * fix: type error for metadata * fix: clean and build fix --------- Co-authored-by: Roberto Lucas <[email protected]> * fix(masterbots.ai): OG not redering (#224) * fix: og to render first letter of username if there's no avatar * fix: clean up * fix: clean up * fix(masterbots.ai): share function (#225) * feat: create action.ts * fix: upt share button * fix: add axios module * fix: add resend module * fix: update vercel env config * fix: split share function * fix: update share component * [coderabbitai] style: upt thread-user-actions condition Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * feat(hasura): update user db schema for pro users (#227) * feat: add get_free_month column to user table * feat: create referral table * feat: add is_blocked column to user table * feat: add pro_user_subscription_id column to user table * fix: upt metadata * fix: update relationship name * feat(hasura): add Ai Model Tracker To Threads (#229) * feat: create 'models' table AI models * fix: add 'model' column to 'thread' table with foreign key constraint * feat: add model_value into models * [masterbots.ai] feat: multi AI models integration (#228) * [masterbots.ai]feat:(multimodels-integration)add actions - helpers - routes * [masterbots.ai]feat:(multimodels-integration)add NextTopLoader * [masterbots.ai]feat:(multimodels-integration)add NextTopLoaders * [masterbots.ai]feat:(multimodels-integration)add new chat components * [masterbots.ai]chore:next version * [masterbots.ai]feat:(multimodels-integration)update use context * [masterbots.ai]feat:(multimodels-integration)icons update * [masterbots.ai]chore:command ui * [masterbots.ai]refactor:moving chat componets to folder * [masterbots.ai]feat:env checker * [masterbots.ai]feat:env guard * docs: site map diagram * [masterbots.ai] fix: multi AI models guard (#235) * fix-guards + dom warning * fix-rename env var - vercel name * chore(masterbots.ai): update payment terms & conditions (#233) * fix: update terms * fix: building error * fix: update terms content * fix: rm the older part at the bottom * feat(masterbots.ai): pro subscription payment + wizard (#226) * feat: added free card * feat: added animation to the plan card * feat: added more plan card and referral code link * fix: clean up * wip: wizard * feat: wizard & modal * feat: plan Design theme and modal Header and Footer * feat: plan clean up * update * clean up * fix: rm plan comp on browse page * fix: wizard clean up * feat: succes & error modal * feat: loading comp * feat: added checkout comp * feat: set up stripe and context * wip: implementing subscription * feat: implementing subscription * feat: payment reciept * fix: clean up receipt * fix: modal not showing & shallow routing * fix: small fix * fix: receipt comp * fix: clean up * fix: shallow rerouting * feat: check if user has an active subscription * fix: coderabbit ob * fix: coderabbit ob * fix: coderabbit clean up update * fix: coderabbit clean up update * fix: coderabbit clean up update * fix: clean up * fix: clean up * fix: page restructuring and status on the receipt * fix: revamp receipt and structure * fix: rm unused file * fix: clean up * fix: update & clean up * fix: update * fix: rm the svg * fix: revamp formatSystemPrompts * fix: revamp msg to formatSystemPrompts * fix: update * fix: refactor the receipt page * fix: rm public key * fix: update * fix: update * fix: update * fix: code refactor for error and loading rendering * ref: calling secret keys from server * ref: receipt page and small fix * fix: rm file * fix(impr): subs & flow ux + cleanup * fix(masterbots.ai): OG not redering (#224) * fix: og to render first letter of username if there's no avatar * fix: clean up * fix: clean up * fix(masterbots.ai): share function (#225) * feat: create action.ts * fix: upt share button * fix: add axios module * fix: add resend module * fix: update vercel env config * fix: split share function * fix: update share component * [coderabbitai] style: upt thread-user-actions condition Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * feat(hasura): update user db schema for pro users (#227) * feat: add get_free_month column to user table * feat: create referral table * feat: add is_blocked column to user table * feat: add pro_user_subscription_id column to user table * fix: upt metadata * fix: update relationship name * feat(hasura): add Ai Model Tracker To Threads (#229) * feat: create 'models' table AI models * fix: add 'model' column to 'thread' table with foreign key constraint * feat: add model_value into models * [masterbots.ai] feat: multi AI models integration (#228) * [masterbots.ai]feat:(multimodels-integration)add actions - helpers - routes * [masterbots.ai]feat:(multimodels-integration)add NextTopLoader * [masterbots.ai]feat:(multimodels-integration)add NextTopLoaders * [masterbots.ai]feat:(multimodels-integration)add new chat components * [masterbots.ai]chore:next version * [masterbots.ai]feat:(multimodels-integration)update use context * [masterbots.ai]feat:(multimodels-integration)icons update * [masterbots.ai]chore:command ui * [masterbots.ai]refactor:moving chat componets to folder * [masterbots.ai]feat:env checker * [masterbots.ai]feat:env guard * docs: site map diagram * feat: set up stripe and context * wip: implementing subscription * fix: rm the svg * fix: replace secret with variable * fix: chat restructure * fix(update): chat restructure * fix(deployment error): can't find an icon or not exported * fix: deployment issues * fix: deployment issues * fix: deployment issues * fix: adjust design * fix: clean up * fix: clean up * fix: color var updaye * [coderabbitai] impr: update apps/masterbots.ai/components/stripe-element.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * [coderabitai] impr: update apps/masterbots.ai/components/succes-content.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: success close button * fix: bg image for yearly card * fix: move func to util * ref: receipt page function to use reac-use * fix: move depencies to the app * fix: clean up * ref: wizard to use radix dialog components * update * fix: coderabitai update --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: Nathanael Liu <[email protected]> Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Brandon Fernández <[email protected]> * [masterbots.ai] fix: llama3 models (#236) * fix-guards + dom warning * fix-rename env var - vercel name * fix-changed PERPLEXITY-LLama model * [masterbots.ai] impr(fix): ui tweaks (#237) * fix(UI):varius UI fixes * fix(UI):varius UI fixes * fix(UI): Tailwind class corrections, conflict resolution, text alignent to the left * fix(UI):update * fix(masterbots.ai): payment feedbacks (#240) * fix: make the dialog content responsive * fix: free plan card adjusted * fix: update * fix: update receipt styles * fix: build error * fix: build error * fix: build error update * fix: update * fix: observation * fix(masterbots.ai): update env variable (#244) * feat: sitemap (#238) * feat: add redirection rules * fix: update all links with new shorten urls * fix: update all links with new shorten urls * feat: make folder structure according to sitemap * [coderabbitai] impr(masterbots.ai): update app/c/page.tsx error handling Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * [coderabbitai] impr(masterbots.ai): update app/c/[category]/[chatbot]/page.tsx error handling Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: build error * [coderabbitai] impr(masterbots.ai): update app/c/[category]/[chatbot]/page.tsx error handling Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * feat: add sitemap and metagraph * fix: use original generateMetadata * fix: update page links * fix: show only filtered threads on page reload * fix: build error --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix(masterbots.ai): show first question & answer in thread list (#246) * feat: add 'disabled' state to ChatAccordion * fix: show default question's answer in thread list * fix: use braces and create explicit statement blocks * fix: subscription mobile responsive tweaks (#245) * update * fix: update * fix: responsiveness * fix: update * fix: few clean up * fix: rm unused image * fix: rm unused image * fix(impr): models enum table migrations (#247) * impr(hasura): db tables * impr(hasura): db tables * fix(hasura): user permissions * impr(hasura): sql models enum migration * fix(hasura): models_enum pk * fix(hasura): ci/cd default regional log bucket * docs: bun to requirements (#250) Co-authored-by: b <b> * feat: next auth, email/pw strategy (#249) * (masterbots.ia)-chore-auth-dependencies * (masterbots.ia)-feat-webauth-nextauth * wip(masterbots.ai): email/pw login + signup * feat-login ui * feat-login-component+page * feat-login-component+page * feat-auth-middleware.ts * feat-auth-nextauth + googleauth * feat-auth-coderabit-feedback * feat-auth-callback + elements added * wip(webapp): email/pw login+signup * feat:add toke storage for webauth * feat:updates webauth * feat:updates webauth * fix(masterbots.ai): blankBot fetch --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: Roberto Romero Lucas <[email protected]> * docs: mb sytem diagram v1.0a * feat(impr): next auth environment helper function (#251) * (masterbots.ia)-chore-auth-dependencies * (masterbots.ia)-feat-webauth-nextauth * wip(masterbots.ai): email/pw login + signup * feat-login ui * feat-login-component+page * feat-login-component+page * feat-auth-middleware.ts * feat-auth-nextauth + googleauth * feat-auth-coderabit-feedback * feat-auth-callback + elements added * wip(webapp): email/pw login+signup * feat:add toke storage for webauth * feat:updates webauth * feat:updates webauth * fix(masterbots.ai): blankBot fetch * feat:protecting env --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: Roberto Romero Lucas <[email protected]> * impr(masterbots.ai): sign up form + sign in session data * docs: claude3 project knowledge docs * fix(masterbots.ai): devMode conditional * chore(masterbots.ai): rm console.log * chore: upt default hardcoded gpt model * fix: toSlug imports * fix: typo * fix(hasura): seeds * chore(impr): MB seeds update and upgrade (#253) * wip: upt seeds * chore: rm alter and table creations * chore(impr): MB seeds update and upgrade * fix: set thread to private by default * fix: prompt row typo * chore(hasura): seeds update default thread publicity * fix(masterbots.ai): adjust arrow direction in thread list (#255) * feat(impr): Vercel AI SDK Update (#256) * chore:ai version upt * chore:ai version upt * upt-ai delete * upt-ai versions * upt-sdk-actions * upt-complete-sdk-3.3 + dev notes * upt-@anthropic-ai/sdk + MessageParam * Delete apps/masterbots.ai/apps/masterbots.ai/package.json * Delete apps/masterbots.ai/apps/masterbots.ai/package-lock.json * impr-convertToCoreMessages ternary * Leandro/develop (#257) * chore: create thread-component to avoid to become thread list into a client component * refactor: remove unnecesary hooks from thread component * refactor: remove unnecesary hooks on thread componen * impr(masterbots): components folder structur (#259) * impr:refactor components folders + names + imports * hotfix:chat-list useEffect dependency removal * fix(masterbots): google signIn (#260) * fix(masterbots.ai): fix thread-component loop (#261) * fix:(masterbots.ai) add useScroll hook (#263) * fix:introducing Two-phase scroll * impr: new hook to handle scrolling * impr: useScroll + respo * feat(masterbots.ai): chat sidebar filtering (#264) * sidebar refactor with ai * fix: sidebar AI V - Prev Jun (#262) * fix:semistable * fix:stable v * impr:delete nonused component * fix: upt category filtering * fix typo --------- Co-authored-by: Roberto Lucas <[email protected]> * feat: sidebar state * fix(masterbots.ai): logic typo * fix(masterbots.ai): ts typo --------- Co-authored-by: Jun Dam <[email protected]> Co-authored-by: Brandon Fernández <[email protected]> * fix(masterbots.ai): bot button redirect change (#265) * wip(masterbots.ai): seo data impr (#267) * wip: seo data impr * impr(chore): ga tags * feat: add chat publicity trigger (#258) * update * feat: design thread visibilty * fix: added the backend * fix: added the backend * fix: rm files * fix: few clean up * fix(masterbots): google signIn (#260) * feat: design thread visibilty * fix: added the backend * fix: few clean up * Leandro/develop (#257) * chore: create thread-component to avoid to become thread list into a client component * refactor: remove unnecesary hooks from thread component * refactor: remove unnecesary hooks on thread componen * impr(masterbots): components folder structur (#259) * impr:refactor components folders + names + imports * hotfix:chat-list useEffect dependency removal * feat: design thread visibilty * fix: added the backend * fix: few clean up * fix: update * fix: add permission * fix: update query * fix(masterbots.ai): fix thread-component loop (#261) * feat: design thread visibilty * fix: added the backend * fix: few clean up * feat: design thread visibilty * fix: added the backend * fix: few clean up * Leandro/develop (#257) * chore: create thread-component to avoid to become thread list into a client component * refactor: remove unnecesary hooks from thread component * refactor: remove unnecesary hooks on thread componen * impr(masterbots): components folder structur (#259) * impr:refactor components folders + names + imports * hotfix:chat-list useEffect dependency removal * feat: design thread visibilty * fix: added the backend * fix: few clean up * update * fix: update * fix: publicity toggle * fix: error catch in the functions * fix: observations * fix: design impr * fix: thread pop-up height * chore(masterbots.ai): log rm & app version upt --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: Leandro Gavidia Santamaria <[email protected]> Co-authored-by: Brandon Fernández <[email protected]> Co-authored-by: Roberto Lucas <[email protected]> * feat(masterbots.ai): user messages ai refactor (#266) * feat:userMessages refactor + hooks and utils * upt:rm console.log * fix:rollback useAiChat hook * fix:rollback - actions * fix(masterbots.ai): sidebar trigger * chore(hasura: s --------- Co-authored-by: Roberto Lucas <[email protected]> * wip: browse sidebar * impr(masterbots.ai): browse sidebar (#270) * fix: browse layout * feat(masterbots.ai): browse sidebar * fix: browse sidebar link condition * chore: upt signup default profile pic * chore: seeds upt (#269) * wip: seeds upt * chore(hasura): seeds review * feat(hasura): add "is_approved" thread field + seeds * chore: mb-genql upt * fix(hasura): thread param permission * fix(masterbots.ai): typo * fix(masterbots.ai): allow svg content-type * fix: chat + browse layout * style: clean up * Seo data (#273) * fix: build error * feat: Add SEO data to the chat page * feat: add default image, if not found * feat: Add SEO data to the browse page * fix: generates the image with error, in api/og * Update route.tsx fix: generates the image with error, in api/og * impr(masterbots.ai): title impr prompt * impr(masterbots.ai): improve current features v2 (#274) * add-impr-chat-prompt-footer-header-disclaimer * add-impr-chat-prompt-footer-header-disclaimer * add-UI-upt * add-UI-upt * add-action-prompt * add-clickable-upt * add-clickable-upt * Masterbots/fix redirects (#275) * fix:avatar-redirects * fix:avatar-redirect * fix(masterbots.ai): upt components/ui/button.tsx Coderabbitai suggestion. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix:URL correction --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * [masterbots.ai] feat: wordware api (#276) * feat: add wordware api + vercel sdk strategy * feat: add wordware api + vercel sdk * wordware describe feat * wordware run + interface * impr(masterbots.ai): upt /api/wordware/describe/route.ts coderabbitai code suggestion. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * impr(masterbots.ai): upt /api/wordware/describe/route.ts coderabbitai code suggestion. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix(masterbots.ai): typo /api/wordware/describe/route.ts coderabbitai code suggestion. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * doc: mb system diagram upt * wip: icl calls integrations * impr(masterbots.ai): permission for thread & user action mode (#281) * update * feat: added permissions & new column * fix: rm unnessecary files * fix: rm permission check * feat(masterbots.ai): create password recovery (#282) * feat:add-recovery-strategy * chore:add nodeemailer * upt:hasura * upt:hasura * upt:gmail service * feat(hasura): otp, token table + junction w/user + mb-genql gen * feat:add recovery password API * fix:ai suggestion + UX * feat:improve ux show password feat * chore:env sample * chore:useSetState * chore:roles --------- Co-authored-by: Roberto Lucas <[email protected]> * [masterbots.ai] impr: WW API sanitize and keep alive (#284) * keep-alive + API sanitize + timeOut guard * impr streamAndValidateResponse fn * wip(masterbots.ai): impr createImprovementPrompt * style(masterbots.ai): chat loading states comments * feat(masterbots.ai): add admin mode to approve thread (#283) * feat:added mode toggle and approve btn * feat: added migration for user role * feat: user role flow implet * fix: impr admin approve process * fix: clean up * fix: toggle CTA changed * fix: update * fix: update * fix: observ * fix: obs clean up * fix: update * fix: clean up * impr(masterbots.ai): alpha metadata chatbot labels (#288) * wip: metadata chatbot labels * wip(masterbots.ai): chatbot metadata labels * impr(masterbots.ai): gen chatMetadata * impr: simplifying prompt defitions + biome.json base config * impr(masterbots.ai): recursive improved text prompt * style: code comments + eslint chk * impr: biome.json config * fix(masterbots.ai): conflicts typo fix * style(impr): cleanPrompt + followingQuestionsPrompt relocation & cleanup * doc: map system (simplified) * fix(masterbots.ai): sideBar updating URL (#286) * fix:sideBar updating URL * feat: coderabbit-ai suggestions * fix: Implement auto-expanding sidebar categories and chatbot highlighting based on URL * feat: optimize sidebar navigation with Link * feat: thread options (#287) * feat: added verified and label to the options * usethreadvisibility as context * feat: added option design and functions * fix: clean up * fix: update * fix: update * fix: obsv * fix: merge and update * fix: update the delete popup * fix: observ * fix: update * fix: delete thread flow * update * fix: update * fix: types * fix: chatbot not required * fix: testing * fix: rm bun.lock * fix: clean up * fix: update * fix(masterbots.ai): temp freezing next version --------- Co-authored-by: Roberto Lucas <[email protected]> * [masterbots.ai] feat: email verification (#289) * feat: email verification * feat: email verification * feat: email verification * upt:build * feat: handle error redirection * chore:cron task * upt: cron blocking instead erasing * feat(hasura): create social following table. (#292) * feat(db): create social following table. * create user following and followers relationships. * fix(db): ensure users can only manage their own follow relationships. * feat(db): social following and user table permissions improvements. * feat(db): improving social following table with timestamp and idx. * impr(db): permissions and tracked object relationships. * impr(db): avoid self follow. * chore(masterbots.ai): guard WordWare for prod routing * [masterbots.ai] fix: public/private tag bg on dark mode (#294) * fix: tag bg * fix: text color * fix: browse page error * fix: debugging * fix: debugging * fix: debugging * fix: added func to generate short link * fix(hasura): upt user permissions (#296) * update user permission * fix: reverse the following table * fix(hasura): build error (#297) * fix: error build * fix: reverse select perm * [masterbots.ai] feat: thread list display + components comments for ai (#299) * merged from develop * feat:add new ui-thread-representation-browse * feat:add comments for ai - C * feat:add comments for ai - b/p * feat:add comments for ai - b/p * feat:add comments for ai - b/p * feat:add app theme colors effects * feat:add comments for ai - b/p * [masterbots.ai] feat: chatbot search tool v0.1a (#295) * wip: chatbot search tool * wip(impr): ww api + chat ui tweaks * fix: init sidebar load state * fix: nesting layout * fix: thread-popup ui header * wip(impr): chatbot tooling * impr: loading state + debug chatbot tools * wip(fix): nodejs context * fix(temp): rm edge runtime api config * [masterbots.ai] feat: reorganize navigation menu for mobile view (#298) * feat: reorganize navigation menu for mobile view * UI: add sideBar style * feat: add link profile and logout icon * Update profile-sidebar.tsx Tailwind class fix * [masterbots.ai] feat: UI + Logic Improvements (#301) * feat:impr responsive * feat:impr password strenght checker * feat:impr responsive * upt-build * feat:respomsive tweask * feat:back arrow aria label * fix:chat mobile layout * fix:code section * fix:chat pannel * fix:chatBot redirection * feat:restore appConfig header * [masterbots.ai] fix: restore desktop navigation link - browse section (#303) * fix:restore desktop navigation link - browse * fix:formating * feat:yellow combobox btn (JUN-REQUEST) * glowing effect variant * upt:removed /b navigation as original v * feat:powerup mode + provider * [masterbots.ai] fix(impr): browse and chat content search (#304) * feat:browse title and content search * feat:browse title and content search * fix:typo * impr:reusable non result component * feat:skeletons * feat:guard * fix:skeletons * fix:chat searching * fix: add accent colour --------- Co-authored-by: Roberto Lucas <[email protected]> * [masterbots.ai] impr: seo sitemap (#306) * chore: sitemap creation * chore: add description based on category * chore: update queries in services * chore: truncate text * impr: upt (browse)/[category]/[threadId]/sitemap.ts coderabbitai code suggestion. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * [masterbots.ai] impr: ai tools (#302) * wip: ai tools * fix: WW json regexp * impr: simplifying main ai call * wip(fix): chat component re-render + cleanup * impr(refactor): chat hooks * fix: ts build * fix: ts build * fix: ts typo * fix: typo * impr: ai feedbacks * [masterbots.ai] wip(impr): web search (#309) * impr: web search tool call * fix: colour values * fix: typo * impr: code suggestions * fix: class name typo * wip(fix): web search false positive response + webSearch context * fix: web search callback * fix: typo * feat: profile page (#300) * feat: user card * fix: update * merge develop && update * feat: user generate bio & favourite topic * fix: update user card * feat: added profile sidebar * fix: update * update * update * update * fix: fetch approved and public threads * fix: fetch approved and public threads * update * fix: clean up and update * update * make fetch user work with bio * update * update * design updating * update * update * fix: few changes * update * fix: design update * fix: footer in layout * fix: update * fix: resercation * update * profile upload * feat: move the cloudinary key to env * fix: layout * fix: layout update * [masterbots.ai] fix: shallow routing for category & chatbots for chat & profile page (#313) * update * feat: added shallow link to the sidebar link * update' * fix: routing and content fetching * fix:update on routing * fix:update * update * update * update * fix: clean up * update * update * [masterbots.ai] feat: update ChatChatbotDetails (#314) * feat: new bot profile - chat * chore: dev comments * chore: white bg bot avatar * feat: add skeleton bot profile * [masterbots.ai] feat: include custom settings options (#317) * feat:relocation of theme switch(jun) * feat: create font-size accessibility provider(jun) * feat: r-sidebar theme switcher relocation + skeleton * feat: impr add rem instead px * [masterbots.ai] feat: integrate drizzle ORM (#320) * feat: create mb-drizzle package initial structure * feat:(masterbots.ai) add drizzle endpoint + service * chore: include database url * chore: upt mb-drizzle * feat: refactor drizzle config + generations * chore: impr migrate * chore: add working drizzle connection + migrations * feat: add centralized actions * chore: add ai review recomendations * chore: webSearch feature flag + use cloudinary upload preset * fix: responsive sidebar fix * fix: ts chk build * fix: sidebar async call * fix: ts build * chore: typo * [masterbots.ai] fix: browse category navigation (#316) * update * fix: rm category * update * fix: pop up on the user threads * update * update clean up * update * fix: clean up * fix: clean up and update * fix: update * fix: popup on navigation * fix: update * update * update * update * clean up * update * merge * fix: hasura thread delete + user dup permissions (#330) * [masterbots.ai] feat: onboarding bot profile variants (#324) * add chatbot-details and browse-details variants * feat: add bio generation * feat: chat profile bg * chore: update bot profile designs * chore: remove internal padding from cardHeader component * impr: iconography + border thickness * fix: numberShortener util fn --------- Co-authored-by: Roberto Lucas <[email protected]> * feat: user following (#319) * update * added follow user * update * fix: upt hasura metadata databases, public_social_following.yaml coderabbitai code suggestion. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: upt masterbots.ai lib, utils.ts coderabbitai suggestion. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: user card * update * fix: permission * update * fix: added more column for chatbot followee * fix:foloow chatbot implementation * update * threads by following user/bots * update * update * update * update * update * update * update * update --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * [masterbots.ai] impr: new sonner (#334) * chore: add new icons * feat: Sonner custom hooks and setup * feat: use useSonner hook throughout the app * fix: overflow of the width of the sonner * chore: add new icons * feat: Sonner custom hooks and setup * feat: use useSonner hook throughout the app * chore: use hook sonner * refactor: changes according to coderabbitai * refactor: update use of sonner * chore:remove icons and use lucide icons * chore: Using Lucide Icons * chore: bun pkg mngr upt * Standardize url building using urlbuilders utility (#341) * fix: update url * fix: url update * update * [masterbots.ai] impr: og Image api dynamic to be useful without thread ID (#335) * update * fix: make OG image use default * fix: update * fix: update * fix: obs * fix: update * fix: added og to browse and chat * update * update * update * fix: provider types error * fix: updfate UUID * fix: update UUID * [masterbots.ai] docs: hook useSonner (#343) * chore: document hook useSonner * refactor: document hook useSonner, according coderabbit * impr: web search response (#310) * impr: web search response * refactor: extracting clickable generation logic * refactor: extracting clickable generation logic * fix: webSearch clickable text + reference links * chore: fix build * feat:(impr) stable version link to references format step 1 * feat:(impr) stable version link to references format step 2 --------- Co-authored-by: Bran18 <[email protected]> * [masterbots.ai] refactor: prelaunch ux/ui changes (#336) * refactor: replicate tooltip effect in desktop bot chatbot details * fix: add guard and removed re-render * fix: refactor mobile bot chatbot details * refactor: make chatPannel bigger * chore:add new bot card design + sidebar hover color * chore: delete public and private sw + icons * chore: include public + delete extra actions * chore: add sidebar bg * add sidebar new styles + lib fn * feat: add select bot * chore: cleaning * fix: build - removing BotMessageSquareIcon * fix: types/node version + node min ver req --------- Co-authored-by: sheriffjimoh <[email protected]> Co-authored-by: Roberto Lucas <[email protected]> * [masterbots.ai] feat: continuous thread ui functionality (#340) * wip: continuos thread logic and functionality. * feat: updating parent thread functionality. * feat: continuous thread UI and finalize functionality. * fix: lowering resolveThreadId logic complexity. * Update apps/hasura/migrations/masterbots/1736934906237_set_fk_public_thread_parent_thread/down.sql Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update apps/masterbots.ai/lib/hooks/use-mb-chat.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: ts build --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Roberto Lucas <[email protected]> * [masterbots.ai] fix: refactored components - pre icl v3 (#348) * chore: add refactored components - pre icl v3 * chore: add navigation color + text-input color * fix: type * wip: header active state * fix: them toggle --------- Co-authored-by: Roberto Lucas <[email protected]> * feat: icl v1a (#344) * wip: vercel ai sdk upt * wip: icl web feature * chore: icl hasura migrations, metadata and seeds * chore: genql gen * impr: chat opt separator render * impr: accordion chevron pos * impr: chat-list space * Fix observations from Jun (#353) * update * fix: update * fix: added empty state * fix: rm favourt and added card empty state * fix: hide sibe category without threads on user profile * fix: update * fix: update * [masterbots.ai] fix: reduce prompt input validation * fix: hasura moderator augmentedFrom msg prop * impr: ai prompt examples flow * fix: hasura moderator role thread upt permissions * [masterbots.ai] feat: chatbot following + thread highlight + bot thread page to blog (#337) * update * feat: added chatbot follow function to other component * update profile thread * thread highligh * thread highligh update * update * fix: thread blog * fix: follow chat bot * update * fix: observations * fix provider types issue * fix provider update * feat: update blog template * fix: rm p tag from list items * fix: merge * fix: rm parentid and continiue reading * update * update * merge * fix: generated types * update * updatd * update code * impr: profile page layout * fix: mg-genql gen ts --------- Co-authored-by: Roberto Lucas <[email protected]> Co-authored-by: Roberto Lucas <[email protected]> * [masterbots.ai] fix: init threads render + icl init cleanup (#354) * wip: fix init threads render + icl cleanup This fixes the following issues: 1. Reduced the amount of re-renders when sending the new data. 2. Clean up the ICL functions and types. 3. State management for the user-thread-panel. 4. Debug the re-rendering uissue that is replacing the main thread content. 5. Debug opening a new thread with the new ICL system. They show in the list but not returning the messages when opening it up. 6. Few code clean ups. * impr: thread list re-render in chat page * fix: initialMessages in useChat * fix: hasura moderator role thread upt permissions * impr: thread list re-render * fix: markdown pkg ts * fix: markdown pkg ts * fix: downgrade react-markdown (#358) * fix: downgrade react-markdown * fix: downgrade react-markdown * fix: markdown dep version + layout thread list ui * impr: gray-ish overlay bg rm * chore: console log rm --------- Co-authored-by: Roberto Lucas <[email protected]> * refactor: icl seeds v2 (#357) * chore: upt hasura icl seeds * chore: chat legacy table rm * chore(wip): icl seeds curation * chore: upt icl init seed pt2 * chore: upt icl init seed pt3 * chore: upt icl init seed pt3 * chore: upt icl init seed pt4 * fix: cat + chatbot seeds revision * chore: tag seeds note upt * fix: drop and create chatbot_domain table (#360) * fix: drop and create chatbot_domain table * fix: chatbot_domain permissions * fix: SQL typo * [masterbots.ai] feat: improve common components and features (#356) * fix: sidebar * feat: add DeepSeek integration * chore: wip accordions * fix: include popup accordion * chore: add shared accordion to thread list * fix: extra space * fix: extra space * chore: add tabs effect * chore: add colors based on routes * chore: add colors based on routes --------- Co-authored-by: Roberto Lucas <[email protected]> * fix: useRouter import * [masterbots.ai] fix: sidebar category render (#362) * fix: sidebar category render * docs: toggleChatbotSelection * [hasura] chore: label + label_chatbot_category_domain dropping tables migration (#361) * fix: fetch chatbotDomain * [hasura] chore: rm wip example seed part * chore: rm legacy tables + fix getChatbotMetadata props (#363) * chore: rm legacy tables * fix: getChatbotMetadata * fix: chatbotMetadata ts * wip(refactor): icl init tags & categories fetch * chore: bun.lockb upt * fix: hotfix build error * impr: icl metadata requests v1 (#365) * wip: icl fetch + meta prompt impr * impr: sidebar paddings * wip: icl fetch + meta prompt impr * wip: icl fetch + meta prompt impr * impr: icl metadata request v2 (#366) * wip: icl fetch + meta prompt impr * fix: icl fetch + meta prompt impr * impr: icl output + prompts * chore: console.log rm * chore: console.log icl metadata devMode * [masterbots.ai] test: sytem prompt as user role * fix: show sidebar in profile (#364) * chore: clickable responses update * [masterbots.ai] refactor: use chat hook context + state management perf (#369) * chore: system prompt as system role * refactor: use-mb-chat to context * fix: mbchat provider location * impr: profile page scroll & footer position (#367) * update * fix: update * update * update * fix: profile page scroll and footer positioning * fix: profile sidebar * update * update * Revert "update" This reverts commit ef7ee8c. * Revert "Revert "update"" This reverts commit 553f82f. * Revert "Revert "Revert "update""" This reverts commit c645eca. * fix: profile page footer positioning * fix: visitor should be able to scroll through the categories * fix: profile page side bar * fix: rm loading when user not logged in * fix: update * [masterbots.ai] fix: clickable text feature (#372) * fix: accordion arrow * fix: clickable text formating * wip: fix thread load (#373) * wip: fix thread-list load * fix: continuous system prompt context * fix: render flickr + followup question logic impr * impr: prompt tags segmentation * chore: impr following question prompt * feat: public continue thread (#375) * refactor: integrating chatPannelHeader into chatPannel * chore: update browse-chat-message with shared accordion * chore: continue conversation + full conversations fix * fix: left align text * [masterbots.ai] fix: show appropriate bot cards in the user thread list (#368) * update * fix: update * update * update * fix: filter category & chatbot by userId on profile page * fix: hide empty chatbots * fix: followee permission error as moderator to follow and unfollow (#374) * update * fix: update * update * update * fix: permission issue for moderator when following other user * fix: shift on user card when loading or empty * update * [masterbots.ai] fix: isNewChat guard + continuous thread messages + power up prompts (#377) * fix: thread render at pop-up close * impr: getRouteType + chat layout * wip: isNewChat state * impr: prompt tags segmentation * fix: chat messages list render + open last according by default on new responses * impr: thread list render guard * feat(wip): isPowerUp mode * impr: memoizing getChatbotMetadata * fix: grabbing previous messages, continous chat * chore: add todo comment * impr: previous thread ui + coderabbitai observations * fix: previous conversation re-render * doc: useEffect biome-ignore * impr: deep obj compare for msg pairs * fix: ts build * fix: ts build * [masterbots.ai] refactor: useScroll hook (#376) * chore: refactor useScroll * chore: refactor useScroll * chore: refactor useScroll * Delete apps/masterbots.ai/lib/context/thread-context.tsx * chore: test commit * fix: import type * chore: add clearTimeout * chore: add destructuring * feat: update use-mb-scroll * feat: update thread component --------- Co-authored-by: Brandon fernandez <[email protected]> * [masterbots.ai] fix: chat stream render (#380) * fix: chat stream render * fix: typo * chore: chatbot prompts init config + active thread hotfixes (#378) * wip: chatbot prompts init config * wip: upt init config seeds, adding prompt configs * chore: upt init config seeds * fix: resetActiveThread guard * impr(wip): masterbot config prompt * chore: icl data curation, domain + category + sub-category * chore: init domain seeds curation * fix: moderator + user role table selection * impr: web prompt config + fix thread list render + code comments * fix: coderabbitai observations * [hasura] chore: upt user insert rows seed * fix: conflict fix --------- Co-authored-by: Gabo Esquivel <[email protected]> Co-authored-by: Jimoh sherifdeen <[email protected]> Co-authored-by: Nathanael Liu <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Brandon Fernández <[email protected]> Co-authored-by: Anouk Rímola <[email protected]> Co-authored-by: Trivium <[email protected]> Co-authored-by: Leandro Gavidia Santamaria <[email protected]> Co-authored-by: Jun Dam <[email protected]> Co-authored-by: Luis Carrión <[email protected]> Co-authored-by: Marco Ledezma <[email protected]> Co-authored-by: Bran18 <[email protected]> Co-authored-by: sheriffjimoh <[email protected]> Co-authored-by: Brandon fernandez <[email protected]>
Summary by Sourcery
Refactor the scroll logic into a reusable
useScroll
hook. This hook provides functions for smooth scrolling to the top and bottom of the chat window, and handles infinite scrolling. It also includes options for customizing the scroll behavior and delay.Bug Fixes:
Enhancements:
Summary by CodeRabbit
New Features
Refactor