Skip to content

Commit e1e9238

Browse files
authored
Merge pull request #1151 from joshunrau/david
fix: #1150
2 parents ae92cd5 + e292c93 commit e1e9238

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

.env.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ API_BASE_URL=http://localhost:5500
9090
VITE_DEV_NETWORK_LATENCY=0
9191
# Whether to force clear queries when the pathname changes
9292
VITE_DEV_FORCE_CLEAR_QUERY_CACHE=false
93+
# Whether to disable tutorial in dev mode
94+
VITE_DEV_DISABLE_TUTORIAL=false
9395
# Plausable analytics config (optional, set both to an empty string to disable)
9496
PLAUSIBLE_BASE_URL=
9597
PLAUSIBLE_WEB_DATA_DOMAIN=

apps/web/src/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const $Config = z.object({
1010
})
1111
.optional(),
1212
dev: z.object({
13+
disableTutorial: $BooleanString.optional(),
1314
isBypassAuthEnabled: $BooleanString.optional(),
1415
isForceClearQueryCacheEnabled: $BooleanString.optional(),
1516
networkLatency: z.coerce.number().int().nonnegative().optional(),
@@ -38,6 +39,7 @@ export const config = await $Config
3839
}
3940
: undefined,
4041
dev: {
42+
disableTutorial: import.meta.env.VITE_DEV_DISABLE_TUTORIAL,
4143
isBypassAuthEnabled: import.meta.env.VITE_DEV_BYPASS_AUTH,
4244
isForceClearQueryCacheEnabled: import.meta.env.VITE_DEV_FORCE_CLEAR_QUERY_CACHE,
4345
networkLatency: import.meta.env.VITE_DEV_NETWORK_LATENCY,

apps/web/src/hooks/useInstrumentRecords.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { reviver } from '@douglasneuroinformatics/libjs';
12
import { $InstrumentRecord } from '@opendatacapture/schemas/instrument-records';
23
import type { InstrumentRecordQueryParams } from '@opendatacapture/schemas/instrument-records';
34
import { useQuery } from '@tanstack/react-query';
@@ -18,7 +19,8 @@ export const useInstrumentRecords = (
1819
enabled,
1920
queryFn: async () => {
2021
const response = await axios.get('/v1/instrument-records', {
21-
params
22+
params,
23+
transformResponse: [(data: string) => JSON.parse(data, reviver) as unknown]
2224
});
2325
return $InstrumentRecord.array().parseAsync(response.data);
2426
},

apps/web/src/providers/WalkthroughProvider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { NavigateOptions } from 'react-router-dom';
1212
import { match } from 'ts-pattern';
1313
import type { Promisable } from 'type-fest';
1414

15+
import { config } from '@/config';
1516
import type { StartSessionFormData } from '@/features/session/components/StartSessionForm';
1617
import { useIsDesktop } from '@/hooks/useIsDesktop';
1718
import { useAppStore } from '@/store';
@@ -429,7 +430,7 @@ export const WalkthroughProvider: React.FC<{ children: React.ReactElement }> = (
429430
const isDesktop = useIsDesktop();
430431

431432
useEffect(() => {
432-
if (isDisclaimerAccepted && !isWalkthroughComplete) {
433+
if (isDisclaimerAccepted && !isWalkthroughComplete && !(import.meta.env.DEV && config.dev.disableTutorial)) {
433434
setIsWalkthroughOpen(true);
434435
}
435436
}, [isDisclaimerAccepted, isWalkthroughComplete]);

apps/web/src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// All of these should be undefined in production
44
interface ImportMetaDevEnv {
55
readonly VITE_DEV_BYPASS_AUTH?: string;
6+
readonly VITE_DEV_DISABLE_TUTORIAL?: string;
67
readonly VITE_DEV_FORCE_CLEAR_QUERY_CACHE?: string;
78
readonly VITE_DEV_NETWORK_LATENCY?: string;
89
readonly VITE_DEV_PASSWORD?: string;

0 commit comments

Comments
 (0)