feat: use countdown timer from channel in client JS#3381
Merged
Conversation
Contributor
SDK Size
|
isekovanic
reviewed
Feb 3, 2026
isekovanic
reviewed
Feb 3, 2026
| export const CooldownTimer = (props: CooldownTimerProps) => { | ||
| const { seconds } = props; | ||
| export const CooldownTimer = () => { | ||
| const seconds = useCooldownRemaining(); |
Contributor
There was a problem hiding this comment.
Why do we display seconds on both the CooldownTimer as well as the AutoCompleteInput ? Is this by design ?
Asking because otherwise we can simply check if the cooldown is happening in the input otherwise, rather than rerendering every time there's a tick.
isekovanic
reviewed
Feb 3, 2026
package/src/components/MessageInput/components/OutputButtons/index.tsx
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors how cooldown logic is handled in the message input components. The main improvement is centralizing cooldown state management using new hooks, which simplifies component props and reduces duplicated logic by using the Cooldown state from Channel in LLC.
Cooldown logic refactor:
useCooldownhook and its associated prop threading, consolidating cooldown state management. (package/src/components/MessageInput/hooks/useCooldown.ts[1]package/src/components/MessageInput/MessageInput.tsx[2] [3] [4] [5] [6] [7] [8] [9] [10] [11]useCooldownRemaininghook to provide the current cooldown state from the channel context, and updated all relevant components to use this hook. (package/src/components/MessageInput/hooks/useCooldownRemaining.tsx[1]package/src/components/AutoCompleteInput/AutoCompleteInput.tsx[2] [3]CooldownTimerto use the new hook and improved its styling to use theme primitives, ensuring consistent appearance. (package/src/components/MessageInput/components/OutputButtons/CooldownTimer.tsx[1] [2] [3]Output button logic improvements:
OutputButtonsto use a newuseIsCooldownActivehook and simplified the rendering logic for send, edit, and cooldown buttons, making use ofuseMemofor performance and clarity. (package/src/components/MessageInput/components/OutputButtons/index.tsx[1] [2] [3] [4] [5] [6] [7]These changes make the codebase easier to maintain and extend, and ensure that cooldown logic is handled consistently across components.