Skip to content

Commit 6bc8f19

Browse files
authored
fix: add Nova CLT guid to prevent initial data ready behaviors for Nova (#236)
1 parent 87170bd commit 6bc8f19

File tree

3 files changed

+70
-12
lines changed

3 files changed

+70
-12
lines changed

src/utilities/__tests__/pollers-test.js

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ describe('pollMember', () => {
217217
})
218218

219219
describe('initial data ready functionality', () => {
220-
it('should set initialDataReady flag when async_account_data_ready becomes true', (done) => {
220+
it('should set initialDataReady flag when async_account_data_ready becomes true', async () => {
221221
const mockMember = createMockMember({
222222
connection_status: ReadableStatuses.CONNECTED,
223223
is_being_aggregated: false,
@@ -227,15 +227,63 @@ describe('pollMember', () => {
227227
mockApi.loadMemberByGuid.mockReturnValue(of(mockMember))
228228
mockApi.loadJob.mockReturnValue(of(mockJob))
229229

230-
const subscription = pollMember(memberGuid, mockApi, clientLocale)
231-
.pipe(take(1))
232-
.subscribe((result) => {
233-
expect(result.initialDataReady).toBe(true)
234-
done()
235-
})
230+
const resultPromise = new Promise((resolve, reject) => {
231+
const subscription = pollMember(memberGuid, mockApi, clientLocale)
232+
.pipe(take(1))
233+
.subscribe({
234+
next: (result) => {
235+
subscription.unsubscribe()
236+
resolve(result)
237+
},
238+
error: (error) => {
239+
subscription.unsubscribe()
240+
reject(error)
241+
},
242+
})
236243

237-
vi.advanceTimersByTime(3000)
238-
subscription.unsubscribe()
244+
// Advance timers to trigger the interval
245+
vi.advanceTimersByTime(3000)
246+
})
247+
248+
const result = await resultPromise
249+
expect(result.initialDataReady).toBe(true)
250+
})
251+
252+
it('should NOT set initialDataReady flag when async_account_data_ready becomes true and CLT guid is excluded', async () => {
253+
const mockMember = createMockMember({
254+
connection_status: ReadableStatuses.CONNECTED,
255+
is_being_aggregated: false,
256+
})
257+
const mockJob = createMockJob(true)
258+
259+
mockApi.loadMemberByGuid.mockReturnValue(of(mockMember))
260+
mockApi.loadJob.mockReturnValue(of(mockJob))
261+
262+
const resultPromise = new Promise((resolve, reject) => {
263+
const subscription = pollMember(
264+
memberGuid,
265+
mockApi,
266+
clientLocale,
267+
'CLT-64ff7421-a8ef-4ac0-90f1-1636eda1a1fd',
268+
)
269+
.pipe(take(1))
270+
.subscribe({
271+
next: (result) => {
272+
subscription.unsubscribe()
273+
resolve(result)
274+
},
275+
error: (error) => {
276+
subscription.unsubscribe()
277+
reject(error)
278+
},
279+
})
280+
281+
// Advance timers to trigger the interval
282+
vi.advanceTimersByTime(3000)
283+
})
284+
285+
const result = await resultPromise
286+
expect(result.initialDataReady).toBe(false)
239287
})
240288

241289
it('should only set initialDataReady once, even on subsequent polls', (done) => {

src/utilities/pollers.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const DEFAULT_POLLING_STATE = {
2626
initialDataReady: false, // whether the initial data ready event has been sent
2727
}
2828

29-
export function pollMember(memberGuid, api, clientLocale) {
29+
export function pollMember(memberGuid, api, clientLocale, clientGuid = null) {
3030
return interval(3000).pipe(
3131
switchMap(() =>
3232
// Poll the currentMember. Catch errors but don't handle it here
@@ -57,7 +57,14 @@ export function pollMember(memberGuid, api, clientLocale) {
5757
initialDataReady: acc.initialDataReady,
5858
}
5959

60-
if (!isError && !acc.initialDataReady && response?.job?.async_account_data_ready) {
60+
// HARD CODED - GROSS... Remove client exclusion when we know how to handle it properly
61+
const excludedClients = ['CLT-64ff7421-a8ef-4ac0-90f1-1636eda1a1fd']
62+
if (
63+
!isError &&
64+
!acc.initialDataReady &&
65+
response?.job?.async_account_data_ready &&
66+
!excludedClients.includes(clientGuid)
67+
) {
6168
pollingState.initialDataReady = true
6269
}
6370

src/views/connecting/Connecting.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { POST_MESSAGES } from 'src/const/postMessages'
4848
import { AnalyticContext } from 'src/Connect'
4949
import { PostMessageContext } from 'src/ConnectWidget'
5050
import { Stack } from '@mui/material'
51+
import { getClientGuid } from 'src/redux/reducers/profilesSlice'
5152

5253
export const Connecting = (props) => {
5354
const {
@@ -60,6 +61,7 @@ export const Connecting = (props) => {
6061
} = props
6162

6263
const selectedInstitution = useSelector(getSelectedInstitution)
64+
const clientGuid = useSelector(getClientGuid)
6365
const sendAnalyticsEvent = useAnalyticsEvent()
6466
const clientLocale = useMemo(() => {
6567
return document.querySelector('html')?.getAttribute('lang') || 'en'
@@ -127,6 +129,7 @@ export const Connecting = (props) => {
127129
}
128130

129131
if (pollingState.initialDataReady) {
132+
// Deprecated: send initial data ready post message Oct 17, 2025
130133
onPostMessage('connect/initialDataReady', {
131134
member_guid: pollingState.currentResponse?.member?.guid,
132135
})
@@ -280,7 +283,7 @@ export const Connecting = (props) => {
280283
})
281284
.pipe(
282285
concatMap((member) =>
283-
pollMember(member.guid, api, clientLocale).pipe(
286+
pollMember(member.guid, api, clientLocale, clientGuid).pipe(
284287
tap((pollingState) => handleMemberPoll(pollingState)),
285288
filter((pollingState) => pollingState.pollingIsDone),
286289
pluck('currentResponse'),

0 commit comments

Comments
 (0)