Skip to content

Commit 0ec6f97

Browse files
committed
fix(selectors): drop the previous-options fallback so a context change cannot leave stale ones selectable
1 parent d8db9d6 commit 0ec6f97

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

apps/sim/hooks/selectors/use-selector-query.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useMemo } from 'react'
22
import { createLogger } from '@sim/logger'
3-
import { keepPreviousData, useInfiniteQuery, useQueries, useQuery } from '@tanstack/react-query'
3+
import { useInfiniteQuery, useQueries, useQuery } from '@tanstack/react-query'
44
import { extractEnvVarName, isEnvVarReference, isReference } from '@/executor/constants'
55
import { usePersonalEnvironment } from '@/hooks/queries/environment'
66
import { getSelectorDefinition, mergeOption } from '@/hooks/selectors/registry'
@@ -84,8 +84,6 @@ export function useSelectorOptions(
8484
definition.fetchList?.({ ...queryArgs, signal }) ?? Promise.resolve([]),
8585
enabled: !supportsPagination && isEnabled,
8686
staleTime: definition.staleTime ?? DEFAULT_SELECTOR_STALE_TIME,
87-
/** `search` is part of the key, so without this the open dropdown empties on every edit. */
88-
placeholderData: keepPreviousData,
8987
})
9088

9189
const pagedQuery = useInfiniteQuery<SelectorPage>({
@@ -102,8 +100,6 @@ export function useSelectorOptions(
102100
initialPageParam: undefined as string | undefined,
103101
enabled: supportsPagination && isEnabled,
104102
staleTime: definition.staleTime ?? DEFAULT_SELECTOR_STALE_TIME,
105-
/** Same reason as the flat query: the key carries `search`. */
106-
placeholderData: keepPreviousData,
107103
})
108104

109105
const { hasNextPage, isFetchingNextPage, fetchNextPage, isError } = pagedQuery

0 commit comments

Comments
 (0)