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

Bugfix: Event Analytics Filters #538

Merged
merged 5 commits into from
Jun 27, 2023
Merged
Changes from 1 commit
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 @@ -4,7 +4,7 @@
*/

import { EuiFlexGroup, EuiFlexItem, EuiHorizontalRule, EuiLink, EuiText } from '@elastic/eui';
import React, { useContext, useState } from 'react';
import React, { useContext, useEffect, useState } from 'react';
import { connect, useDispatch } from 'react-redux';
import {
FILTERED_PATTERN,
Expand Down Expand Up @@ -49,11 +49,16 @@ const EventPatterns = ({
requestParams: { tabId },
});

// refresh filters on opening page
TackAdam marked this conversation as resolved.
Show resolved Hide resolved
useEffect(() => {
onPatternSelection('');
}, []);

const onPatternSelection = async (pattern: string) => {
if (query[FILTERED_PATTERN] === pattern) {
return;
}
dispatch(
await dispatch(
Copy link
Collaborator

@derek-ho derek-ho Jun 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here on why this works and also remove the commented out tempQuery and its comment to reduce tech debt going forward? Why did await work on a dispatch call even though the IDE is saying it has no effect, why do we not need to worry about tempquery anymore, etc.?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changeQuery({
tabId,
query: {
Expand All @@ -62,7 +67,7 @@ const EventPatterns = ({
})
);
// workaround to refresh callback and trigger fetch data
await setTempQuery(query[RAW_QUERY]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment here about the tempquery - can we remove it all together? If it is necessary can we consolidate it into the query in redux instead of having a separate useState variable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed tempQuery from log patterns, It is still used in explorer to handle query searches and changes.

// await setTempQuery(query[RAW_QUERY]);
await handleTimeRangePickerRefresh(true);
};

Expand Down