Skip to content

Commit f988b49

Browse files
committed
Apollo: On lazy hooks ferchPolicy goes on hook, not on trigger
1 parent cfea3bd commit f988b49

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

ui/src/components/map/queries/useResolveStopHoverTitle.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ type ResolveStopNameFn = (stopPlaceNetexId: string) => Promise<string | null>;
2424
function useResolveStopName(
2525
areas: ReadonlyArray<MapStopArea>,
2626
): ResolveStopNameFn {
27-
const [resolveStopNameFromDB] = useResolveStopNameLazyQuery();
27+
const [resolveStopNameFromDB] = useResolveStopNameLazyQuery({
28+
fetchPolicy: 'cache-first',
29+
});
2830

2931
return useCallback(
3032
async (stopPlaceNetexId: string) => {
@@ -38,7 +40,6 @@ function useResolveStopName(
3840

3941
const dbName = await resolveStopNameFromDB({
4042
variables: { stopPlaceNetexId },
41-
fetchPolicy: 'cache-first',
4243
}).then(
4344
(result) =>
4445
result.data?.stops_database?.stops_database_stop_place_newest_version.at(

ui/src/components/stop-registry/stops/stop-details/stop-version/utils/useGetOverlappingStopVersions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ const GQL_GET_OVERLAPPING_STOP_VERSIONS_QUERY = gql`
6464
`;
6565

6666
export function useGetOverlappingStopVersions() {
67-
const [getOverlappingStopVersions] = useGetOverlappingStopVersionsLazyQuery();
67+
const [getOverlappingStopVersions] = useGetOverlappingStopVersionsLazyQuery({
68+
fetchPolicy: 'network-only',
69+
});
6870
const [getOverlappingStopVersionsIndefinite] =
6971
useGetOverlappingStopVersionsIndefiniteLazyQuery();
7072

@@ -94,7 +96,6 @@ export function useGetOverlappingStopVersions() {
9496
fromDate: fromDateTime,
9597
toDate: toDateTime,
9698
},
97-
fetchPolicy: 'network-only',
9899
});
99100

100101
if (data && data?.service_pattern_scheduled_stop_point.length > 0) {

0 commit comments

Comments
 (0)