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

[Security Solution] Fix rules filtering after enabling/disabling a rule #151284

Merged
Merged
Show file tree
Hide file tree
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 @@ -35,6 +35,9 @@ export const useFetchRuleByIdQuery = (id: string, options?: UseQueryOptions<Rule
{
...DEFAULT_QUERY_OPTIONS,
...options,
// Mark this query as immediately stale helps to avoid problems related to filtering.
// e.g. enabled and disabled state filter require data update which happens at the backend side
staleTime: 0,
enabled: !!id,
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export const useFindRulesQuery = (
},
{
...DEFAULT_QUERY_OPTIONS,
// Mark this query as immediately stale helps to avoid problems related to filtering.
// e.g. enabled and disabled state filter require data update which happens at the backend side
staleTime: 0,
Comment on lines +57 to +59
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix, @maximpn. And appreciate the comment here.
Could you please also add staleTime: 0 to the useFetchRuleByIdQuery hook? So we'll be sure no stale data is displayed on the rule detail page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

...queryOptions,
}
);
Expand Down