Closed malbonesi closed 5 years ago
Thought there might have been an issue, but I think it's all good!
I was thinking logIdle should remain for code bases that are already using that, but maybe with this approach, logIdle could be removed and users should just include 'APP_IDLE' in ignoreBundles if they want to skip it?
what if instead of a list (or the logIdle
) we just took an action filter function that you could provide? Then you can filter out whatever you want, for example:
// a single action
createDebugBundle({
actionFilter: action => action.type !== 'APP_IDLE'
})
// a list of actions
createDebugBundle({
actionFilter: action => ['SOME_ACTION', 'SOME_OTHER'].includes(action.type)
})
// only log a certain action you care about
createDebugBundle({
actionFilter: action => action.type === 'BLAH'
})
// actions without payloads
createDebugBundle({
actionFilter: action => !action.payload
})
I went ahead and did the actionFilter approach, but wanted to give you credit for the idea so I merged this, but modified it a bit. Thanks @malbonesi!
Ah very cool. For what it's worth, it feels a little strange having to use a function to configure something like this, but I don't actually have a different solution and this certainly offers the most control.
In any case, thanks for merging (and for this lib in general)! It looks like the documentation piece I added in docs/api/included-bundles.md is still there, btw :)
I hear ya, but the whole thing is for debugging so I think passing a function is pretty reasonable. It lets you do whatever. Write it once and forget it. Or you can customize it if you're trying to focus in on just a few things.
Yeah right on. Thanks :)
Along the lines of ignoring APP_IDLE events, I thought this might be useful for other custom actions that are dispatched often.
createDebugBundle({ignoreActions: ['GEOLOCATION_SUCCESS']})