Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix date picker changes not triggering chats reload #23

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export const useUnifiedSearch = () => {

const {
data: {
query: { filterManager: filterManagerService, queryString: queryStringService },
query: {
filterManager: filterManagerService,
queryString: queryStringService,
timefilter: timeFilterService,
},
},
telemetry,
} = services;
Expand Down Expand Up @@ -95,8 +99,9 @@ export const useUnifiedSearch = () => {
const onDateRangeChange = useCallback(
(dateRange: StringDateRange) => {
setSearch({ type: 'SET_DATE_RANGE', dateRange });
updateSearchSessionId();
},
[setSearch]
[setSearch, updateSearchSessionId]
);

const onQueryChange = useCallback(
Expand All @@ -115,9 +120,8 @@ export const useUnifiedSearch = () => {
const onSubmit = useCallback(
({ dateRange }: { dateRange: TimeRange }) => {
onDateRangeChange(dateRange);
updateSearchSessionId();
},
[onDateRangeChange, updateSearchSessionId]
[onDateRangeChange]
);

const parsedDateRange = useMemo(() => {
Expand Down Expand Up @@ -182,6 +186,16 @@ export const useUnifiedSearch = () => {
.subscribe()
);

subscription.add(
timeFilterService.timefilter
.getTimeUpdate$()
.pipe(
map(() => timeFilterService.timefilter.getTime()),
tap((dateRange) => onDateRangeChange(dateRange))
)
.subscribe()
);

subscription.add(
queryStringService
.getUpdates$()
Expand All @@ -195,7 +209,14 @@ export const useUnifiedSearch = () => {
return () => {
subscription.unsubscribe();
};
}, [filterManagerService, queryStringService, onQueryChange, onFiltersChange]);
}, [
filterManagerService,
queryStringService,
onQueryChange,
onFiltersChange,
timeFilterService.timefilter,
onDateRangeChange,
]);

// Track telemetry event on query/filter/date changes
useEffect(() => {
Expand Down