Skip to content

Commit 0b3f758

Browse files
style: format code
1 parent 7d844b6 commit 0b3f758

7 files changed

Lines changed: 200 additions & 197 deletions

File tree

app/components/Views/Settings/NotificationsSettings/hooks/useNotificationStoragePreferences.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ const buildPreferences = (
7777
type QueryResult = ReturnType<typeof useQuery>;
7878

7979
const makeQueryResult = (
80-
overrides: Partial<Omit<QueryResult, 'isLoading'> & { isLoading: boolean }> = {},
80+
overrides: Partial<
81+
Omit<QueryResult, 'isLoading'> & { isLoading: boolean }
82+
> = {},
8183
): QueryResult =>
8284
({
8385
data: undefined,

app/components/Views/Settings/NotificationsSettings/hooks/useNotificationStoragePreferences.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export const useNotificationStoragePreferences = () => {
3838

3939
const enqueuePersist = useCallback(
4040
async <
41-
PreferenceType extends NotificationStoragePreferenceSection =
42-
NotificationStoragePreferenceSection,
41+
PreferenceType extends
42+
NotificationStoragePreferenceSection = NotificationStoragePreferenceSection,
4343
>(
4444
nextPreferences: NotificationStoragePreferences,
4545
updatedType?: PreferenceType,
@@ -76,7 +76,9 @@ export const useNotificationStoragePreferences = () => {
7676
) => {
7777
if (!data) {
7878
Logger.error(
79-
new Error(`No notification preferences found when updating ${type} section, enable notifications first`),
79+
new Error(
80+
`No notification preferences found when updating ${type} section, enable notifications first`,
81+
),
8082
);
8183
return;
8284
}
@@ -92,7 +94,7 @@ export const useNotificationStoragePreferences = () => {
9294
({
9395
...(previousPreferences ?? nextPreferences),
9496
[type]: nextSectionPreferences,
95-
} as NotificationStoragePreferences),
97+
}) as NotificationStoragePreferences,
9698
);
9799

98100
try {
@@ -113,7 +115,9 @@ export const useNotificationStoragePreferences = () => {
113115
) => {
114116
if (!data) {
115117
Logger.error(
116-
new Error('No notification preferences found when updating preference, enable notifications first'),
118+
new Error(
119+
'No notification preferences found when updating preference, enable notifications first',
120+
),
117121
);
118122
return;
119123
}

app/components/Views/SocialLeaderboard/NotificationPreferences/hooks/useNotificationPreferences.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,18 @@ export const useNotificationPreferences =
113113
// Each mutation captures its generation; only rolls back if still current.
114114
const generationRef = useRef(0);
115115

116-
const enqueuePersist = useCallback((nextSocialAI: SocialAIPreference) => {
117-
const next = writeChainRef.current.then(async () => {
118-
await updatePreferencesSection('socialAI', nextSocialAI);
119-
});
120-
// Swallow the chain's error so one failure doesn't jam subsequent
121-
// writes. The returned promise still rejects for the caller.
122-
writeChainRef.current = next.catch(() => undefined);
123-
return next;
124-
}, [updatePreferencesSection]);
116+
const enqueuePersist = useCallback(
117+
(nextSocialAI: SocialAIPreference) => {
118+
const next = writeChainRef.current.then(async () => {
119+
await updatePreferencesSection('socialAI', nextSocialAI);
120+
});
121+
// Swallow the chain's error so one failure doesn't jam subsequent
122+
// writes. The returned promise still rejects for the caller.
123+
writeChainRef.current = next.catch(() => undefined);
124+
return next;
125+
},
126+
[updatePreferencesSection],
127+
);
125128

126129
const applyChange = useCallback(
127130
async (updater: (prev: SocialAIPreference) => SocialAIPreference) => {

app/components/Views/SocialLeaderboard/TopTradersView/TopTradersView.test.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,15 @@ describe('TopTradersView', () => {
133133
fireEvent.press(
134134
screen.getByTestId(TopTradersViewSelectorsIDs.NOTIFICATION_BUTTON),
135135
);
136-
expect(mockNavigate).toHaveBeenCalledWith(
137-
Routes.SETTINGS_VIEW,
138-
{
139-
screen: Routes.SETTINGS.NOTIFICATION_SETTINGS_SECTION,
140-
params: {
141-
type: 'socialAI',
142-
title: 'Trading Signals',
143-
description:
144-
'Updates from traders and assets you follow, plus currated market news',
145-
},
136+
expect(mockNavigate).toHaveBeenCalledWith(Routes.SETTINGS_VIEW, {
137+
screen: Routes.SETTINGS.NOTIFICATION_SETTINGS_SECTION,
138+
params: {
139+
type: 'socialAI',
140+
title: 'Trading Signals',
141+
description:
142+
'Updates from traders and assets you follow, plus currated market news',
146143
},
147-
);
144+
});
148145
});
149146

150147
it('navigates to notification settings when preferences do not exist yet', () => {

app/components/Views/SocialLeaderboard/TraderProfileView/components/TraderNotificationsBottomSheet/TraderNotificationsBottomSheet.test.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,19 +328,16 @@ describe('TraderNotificationsBottomSheet', () => {
328328
),
329329
);
330330

331-
expect(mockNavigate).toHaveBeenCalledWith(
332-
Routes.SETTINGS_VIEW,
333-
{
334-
screen: Routes.SETTINGS.NOTIFICATION_SETTINGS_SECTION,
335-
params: {
336-
type: 'socialAI',
337-
title: strings('app_settings.notifications_opts.social_ai_title'),
338-
description: strings(
339-
'app_settings.notifications_opts.social_ai_desc',
340-
),
341-
},
331+
expect(mockNavigate).toHaveBeenCalledWith(Routes.SETTINGS_VIEW, {
332+
screen: Routes.SETTINGS.NOTIFICATION_SETTINGS_SECTION,
333+
params: {
334+
type: 'socialAI',
335+
title: strings('app_settings.notifications_opts.social_ai_title'),
336+
description: strings(
337+
'app_settings.notifications_opts.social_ai_desc',
338+
),
342339
},
343-
);
340+
});
344341
});
345342

346343
it('navigates to notification settings when preferences do not exist yet', () => {

0 commit comments

Comments
 (0)