redux-toolkit
redux-toolkit copied to clipboard
invalidatesTags - minor improvement
I want this logic in invalidatesTags:
invalidatesTags: (_, __, body) => {
return body.meetingId ? ["Meetings", "Meeting Item"] : ["Meetings"];
}
but maybe would be nice if in the returned array falsey values get ignored, so I could then write:
invalidatesTags: (_, __, body) => {
return ["Meetings", body.meetingId && "Meeting Item"]
}
Or at least throw an error, because in this latter variant no error is thrown but the Meetings dont refresh.
P.S. I mean, I guess I can chain the returned array with .filter(i => i)