Skip to content
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 @@ -15,12 +15,17 @@ import * as i18n from './translations';
* @param id desired Rule ID's (not rule_id)
*
*/
export const useRule = (id: string) => {
export const useRule = (id: string, showToast = true) => {
const { addError } = useAppToasts();

return useFetchRuleByIdQuery(id, {
onError: (error) => {
addError(error, { title: i18n.RULE_AND_TIMELINE_FETCH_FAILURE });
},
});
return useFetchRuleByIdQuery(
id,
showToast
? {
onError: (error) => {
addError(error, { title: i18n.RULE_AND_TIMELINE_FETCH_FAILURE });
},
}
: undefined
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const buildLastAlertQuery = (ruleId: string) => ({
* In that case, try to fetch the latest alert generated by the rule and retrieve the rule data from the alert (fallback).
*/
export const useRuleWithFallback = (ruleId: string): UseRuleWithFallback => {
const { isLoading: ruleLoading, data: ruleData, error, refetch } = useRule(ruleId);
const { isLoading: ruleLoading, data: ruleData, error, refetch } = useRule(ruleId, false);
const { addError } = useAppToasts();

const isExistingRule = !isNotFoundError(error);
Expand Down