Skip to content

Commit 938bf4c

Browse files
committed
fix: lint issues
1 parent d7490c6 commit 938bf4c

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

package/src/__tests__/offline-support/offline-feature.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export const Generic = () => {
193193
BetterSqlite.dropAllTables();
194194
});
195195

196-
afterEach(async () => {
196+
afterEach(() => {
197197
BetterSqlite.dropAllTables();
198198
BetterSqlite.closeDB();
199199

@@ -339,7 +339,7 @@ export const Generic = () => {
339339

340340
renderComponent();
341341

342-
await waitFor(async () => {
342+
await waitFor(() => {
343343
act(() => dispatchConnectionChangedEvent(chatClient));
344344
expect(screen.getByTestId('channel-list')).toBeTruthy();
345345
expect(screen.getByTestId(emptyChannel.cid)).toBeTruthy();
@@ -381,7 +381,7 @@ export const Generic = () => {
381381
channels.push(newChannel);
382382
useMockedApis(chatClient, [getOrCreateChannelApi(newChannel)]);
383383

384-
await waitFor(async () => {
384+
await waitFor(() => {
385385
act(() => dispatchNotificationMessageNewEvent(chatClient, newChannel.channel));
386386

387387
const channelIdsOnUI = screen

package/src/components/Chat/Chat.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ const ChatWithContext = <
201201
useEffect(() => {
202202
if (!(userID && enableOfflineSupport)) return;
203203

204-
const initializeDatabase = async () => {
204+
const initializeDatabase = () => {
205205
// This acts as a lock for some very rare occurrences of concurrency
206206
// issues we've encountered before with the QuickSqliteClient being
207207
// uninitialized before it's being invoked.
@@ -222,6 +222,7 @@ const ChatWithContext = <
222222
SqliteClient.closeDB();
223223
}
224224
};
225+
// eslint-disable-next-line react-hooks/exhaustive-deps
225226
}, [userID, enableOfflineSupport]);
226227

227228
useEffect(() => {
@@ -238,13 +239,7 @@ const ChatWithContext = <
238239

239240
// In case something went wrong, make sure to also unsubscribe the listener
240241
// on unmount if it exists to prevent a memory leak.
241-
useEffect(
242-
() => () => {
243-
console.log('Unsubscribing from connection changed listener');
244-
DBSyncManager.connectionChangedListener?.unsubscribe();
245-
},
246-
[],
247-
);
242+
useEffect(() => () => DBSyncManager.connectionChangedListener?.unsubscribe(), []);
248243

249244
const initialisedDatabase =
250245
initialisedDatabaseConfig.initialised && userID === initialisedDatabaseConfig.userID;

package/src/components/Chat/hooks/handleEventToSyncDB.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const handleEventToSyncDB = async <
8181
const cid = event.cid;
8282
const user = event.user;
8383
if (user?.id && cid) {
84-
return await queriesWithChannelGuard(async (flushOverride) =>
84+
return await queriesWithChannelGuard((flushOverride) =>
8585
upsertReads({
8686
cid,
8787
flush: flushOverride,
@@ -115,7 +115,7 @@ export const handleEventToSyncDB = async <
115115
if (message && !message.parent_id) {
116116
// Update only if it exists, otherwise event could be related
117117
// to a message which is not in database.
118-
return await queriesWithChannelGuard(async (flushOverride) =>
118+
return await queriesWithChannelGuard((flushOverride) =>
119119
updateMessage({
120120
flush: flushOverride,
121121
message,
@@ -128,7 +128,7 @@ export const handleEventToSyncDB = async <
128128
const message = event.message;
129129
if (message && event.reaction) {
130130
// We update the entire message to make sure we also update reaction_groups
131-
return await queriesWithChannelGuard(async (flushOverride) =>
131+
return await queriesWithChannelGuard((flushOverride) =>
132132
updateMessage({
133133
flush: flushOverride,
134134
message,
@@ -143,7 +143,7 @@ export const handleEventToSyncDB = async <
143143
// Here we are relying on the fact message.latest_reactions always includes
144144
// the new reaction. So we first delete all the existing reactions and populate
145145
// the reactions table with message.latest_reactions
146-
return await queriesWithChannelGuard(async (flushOverride) =>
146+
return await queriesWithChannelGuard((flushOverride) =>
147147
updateMessage({
148148
flush: flushOverride,
149149
message,
@@ -202,7 +202,7 @@ export const handleEventToSyncDB = async <
202202
const member = event.member;
203203
const cid = event.cid;
204204
if (member && cid) {
205-
return await queriesWithChannelGuard(async (flushOverride) =>
205+
return await queriesWithChannelGuard((flushOverride) =>
206206
upsertMembers({
207207
cid,
208208
flush: flushOverride,
@@ -216,7 +216,7 @@ export const handleEventToSyncDB = async <
216216
const member = event.member;
217217
const cid = event.cid;
218218
if (member && cid) {
219-
return await queriesWithChannelGuard(async (flushOverride) =>
219+
return await queriesWithChannelGuard((flushOverride) =>
220220
deleteMember({
221221
cid,
222222
flush: flushOverride,

package/src/components/Chat/hooks/useAppSettings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export const useAppSettings = <
7575
}
7676

7777
enforeAppSettings();
78+
// eslint-disable-next-line react-hooks/exhaustive-deps
7879
}, [client, isOnline, initialisedDatabase]);
7980

8081
return appSettings;

package/src/contexts/messageInputContext/MessageInputContext.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,6 @@ export const MessageInputProvider = <
918918
customMessageData,
919919
}: {
920920
customMessageData?: Partial<Message<StreamChatGenerics>>;
921-
// eslint-disable-next-line require-await
922921
} = {}) => {
923922
if (sending.current) {
924923
return;

package/src/store/SqliteClient.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-underscore-dangle */
21
import type { DB, OPSQLite } from '@op-engineering/op-sqlite';
32
let sqlite: typeof OPSQLite;
43

0 commit comments

Comments
 (0)