Skip to content

Commit

Permalink
fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Jan 28, 2023
1 parent 1841f73 commit d8d5016
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps)
);
const selectedDataViewRef = useRef<DataView | null | undefined>(selectedDataView);
const showFieldList = sidebarState.status !== DiscoverSidebarReducerStatus.INITIAL;
// todo verify if is correct
const useLegacy = services.uiSettings.get<boolean>('lens:useFieldExistenceSampling');

const querySubscriberResult = useQuerySubscriber({ data });

Expand Down Expand Up @@ -189,7 +187,6 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps)
const subscription = props.documents$.subscribe((documentState) => {
console.log('*** documents$ is firing', documentState.recordRawType);
const isPlainRecordType = documentState.recordRawType === RecordRawType.PLAIN;
const fieldsFromResults = useLegacy || isPlainRecordType;

// todo - make this parallel to fetch - what triggers new docs?
switch (documentState?.fetchStatus) {
Expand All @@ -202,13 +199,8 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps)
});
break;
case FetchStatus.LOADING:
console.log(
'*** fetchStatus.LOADING is firing ',
fieldsFromResults,
useLegacy,
isPlainRecordType
);
if (fieldsFromResults) {
console.log('*** fetchStatus.LOADING is firing ', isPlainRecordType);
if (isPlainRecordType) {
console.log('*** BOO OLDDDD');
dispatchSidebarStateAction({
type: DiscoverSidebarReducerActionType.DOCUMENTS_LOADING,
Expand All @@ -222,7 +214,7 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps)
}
break;
case FetchStatus.COMPLETE:
if (fieldsFromResults) {
if (isPlainRecordType) {
dispatchSidebarStateAction({
type: DiscoverSidebarReducerActionType.DOCUMENTS_LOADED,
payload: {
Expand All @@ -233,7 +225,8 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps)
},
});
}
if (fieldsFromResults) {
/*
if (isPlainRecordType) {
dispatchSidebarStateAction({
type: DiscoverSidebarReducerActionType.DOCUMENTS_LOADED,
payload: {
Expand All @@ -246,6 +239,7 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps)
},
});
}
*/
break;
case FetchStatus.ERROR:
dispatchSidebarStateAction({
Expand All @@ -262,7 +256,7 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps)
}
});
return () => subscription.unsubscribe();
}, [props.documents$, dispatchSidebarStateAction, selectedDataViewRef, useLegacy, fetchFields]);
}, [props.documents$, dispatchSidebarStateAction, selectedDataViewRef, fetchFields]);

useEffect(() => {
if (selectedDataView !== selectedDataViewRef.current) {
Expand Down

0 comments on commit d8d5016

Please sign in to comment.