diff --git a/js_modules/dagster-ui/packages/ui-core/src/asset-selection/input/AssetSelectionInput.oss.tsx b/js_modules/dagster-ui/packages/ui-core/src/asset-selection/input/AssetSelectionInput.oss.tsx index ef87451179f9b..bf32cb6d4f1d4 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/asset-selection/input/AssetSelectionInput.oss.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/asset-selection/input/AssetSelectionInput.oss.tsx @@ -27,6 +27,8 @@ interface AssetSelectionInputProps { const FUNCTIONS = ['sinks', 'roots']; +const linter = createSelectionLinter({Lexer: AssetSelectionLexer, Parser: AssetSelectionParser}); + export const AssetSelectionInput = ({value, onChange, assets}: AssetSelectionInputProps) => { const attributesMap = useMemo(() => { const assetNamesSet: Set = new Set(); @@ -87,10 +89,6 @@ export const AssetSelectionInput = ({value, onChange, assets}: AssetSelectionInp }; }, [assets]); - const linter = useMemo( - () => createSelectionLinter({Lexer: AssetSelectionLexer, Parser: AssetSelectionParser}), - [], - ); return ( }; definition?: FilterableAssetDefinition | null; }, ->( - assets: T[], - assetsLoading?: boolean, -) => { +>({ + assets, + assetsLoading, +}: { + assets: T[]; + assetsLoading?: boolean; +}) => { const [assetSelection, setAssetSelection] = useAssetSelectionState(); const {graphQueryItems, loading, filtered} = useAssetSelectionFiltering({ diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AssetsCatalogTable.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AssetsCatalogTable.tsx index 5265eaae1d4d6..473becfa6a211 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AssetsCatalogTable.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/AssetsCatalogTable.tsx @@ -211,7 +211,10 @@ export const AssetsCatalogTable = ({ kindFilter, } = useAssetCatalogFiltering({assets}); const {filterInput, filtered, loading, assetSelection, setAssetSelection} = - useAssetSelectionInput(partiallyFiltered, !assets); + useAssetSelectionInput({ + assets: partiallyFiltered, + assetsLoading: !assets || filteredAssetsLoading, + }); useBlockTraceUntilTrue('useAllAssets', !!assets?.length && !loading); diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/__tests__/AssetTables.test.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/__tests__/AssetTables.test.tsx index 1c117cee6d3e8..46be35ec8ac9d 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/__tests__/AssetTables.test.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/__tests__/AssetTables.test.tsx @@ -4,6 +4,7 @@ import userEvent from '@testing-library/user-event'; import {MemoryRouter} from 'react-router'; import {RecoilRoot} from 'recoil'; +import {useAssetSelectionInput} from '../../asset-selection/useAssetSelectionInput'; import {mockViewportClientRect, restoreViewportClientRect} from '../../testing/mocking'; import {WorkspaceProvider} from '../../workspace/WorkspaceContext/WorkspaceContext'; import {buildWorkspaceMocks} from '../../workspace/WorkspaceContext/__fixtures__/Workspace.fixtures'; @@ -33,16 +34,24 @@ const MOCKS = [ jest.mock('../../graph/asyncGraphLayout', () => ({})); jest.mock('shared/asset-selection/useAssetSelectionInput', () => { + const mock: typeof useAssetSelectionInput = ({ + assets, + assetsLoading, + }: { + assets: any; + assetsLoading?: boolean; + }) => { + return { + filterInput:
, + fetchResult: {loading: false}, + loading: !!assetsLoading, + filtered: assets, + assetSelection: '', + setAssetSelection: () => {}, + }; + }; return { - useAssetSelectionInput: (assets: any) => { - return { - filterInput:
, - fetchResult: {loading: false}, - filtered: assets, - assetSelection: '', - setAssetSelection: () => {}, - }; - }, + useAssetSelectionInput: mock, }; }); diff --git a/js_modules/dagster-ui/packages/ui-core/src/selection/SelectionAutoCompleteInput.tsx b/js_modules/dagster-ui/packages/ui-core/src/selection/SelectionAutoCompleteInput.tsx index e021299a40ee4..8dee76b07deaa 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/selection/SelectionAutoCompleteInput.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/selection/SelectionAutoCompleteInput.tsx @@ -102,6 +102,10 @@ export const SelectionAutoCompleteInput = , N showHint(instance, hintRef.current); }); + cmInstance.current.on('focus', (instance: Editor) => { + showHint(instance, hintRef.current); + }); + cmInstance.current.on('cursorActivity', (instance: Editor) => { applyStaticSyntaxHighlighting(instance); showHint(instance, hintRef.current);