redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

invalidatesTags - minor improvement

Open croraf opened this issue 1 year ago • 1 comments

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)

croraf avatar Sep 28 '24 12:09 croraf