Skip to content

Commit eb46ef5

Browse files
refactor: cleanup debounce/throttle related un-used changes
1 parent 9d6113a commit eb46ef5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

package/src/components/Channel/Channel.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const throttleOptions = {
181181
trailing: true,
182182
};
183183
const debounceOptions = {
184-
leading: false,
184+
leading: true,
185185
trailing: true,
186186
};
187187

@@ -681,14 +681,14 @@ const ChannelWithContext = <
681681
).current;
682682

683683
const copyMessagesState = useRef(
684-
debounce(
684+
throttle(
685685
() => {
686686
if (channel) {
687687
setMessages([...channel.state.messages]);
688688
}
689689
},
690690
newMessageStateUpdateThrottleInterval,
691-
debounceOptions,
691+
throttleOptions,
692692
),
693693
).current;
694694

@@ -717,7 +717,7 @@ const ChannelWithContext = <
717717
).current;
718718

719719
const copyChannelState = useRef(
720-
debounce(
720+
throttle(
721721
() => {
722722
setLoading(false);
723723
if (channel) {
@@ -730,7 +730,7 @@ const ChannelWithContext = <
730730
}
731731
},
732732
stateUpdateThrottleInterval,
733-
debounceOptions,
733+
throttleOptions,
734734
),
735735
).current;
736736

@@ -1232,7 +1232,6 @@ const ChannelWithContext = <
12321232
const updatedMessage = { ...message };
12331233
if (updatedMessage.attachments?.length) {
12341234
for (let i = 0; i < updatedMessage.attachments?.length; i++) {
1235-
// TODO: abstract the following logic to a separate function for DRY within MessageInputContext
12361235
const attachment = updatedMessage.attachments[i];
12371236
const file = attachment.originalFile;
12381237
// check if image_url is not a remote url

0 commit comments

Comments
 (0)