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

Add ignoreActions option to createDebugBundle #59

Conversation

@malbonesi
Copy link
Contributor

@malbonesi malbonesi commented Aug 28, 2019

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']})

@malbonesi malbonesi closed this Aug 28, 2019
@malbonesi malbonesi deleted the feature/debug-bundle-ignore-actions branch Aug 28, 2019
@malbonesi malbonesi restored the feature/debug-bundle-ignore-actions branch Aug 28, 2019
@malbonesi malbonesi reopened this Aug 28, 2019
@malbonesi
Copy link
Contributor Author

@malbonesi malbonesi commented Aug 28, 2019

Thought there might have been an issue, but I think it's all good!

Loading

@malbonesi
Copy link
Contributor Author

@malbonesi malbonesi commented Aug 29, 2019

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?

Loading

@HenrikJoreteg
Copy link
Owner

@HenrikJoreteg HenrikJoreteg commented Sep 5, 2019

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
})

Loading

@HenrikJoreteg HenrikJoreteg merged commit 54705d5 into HenrikJoreteg:master Sep 5, 2019
@HenrikJoreteg
Copy link
Owner

@HenrikJoreteg HenrikJoreteg commented Sep 5, 2019

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!

Loading

@malbonesi
Copy link
Contributor Author

@malbonesi malbonesi commented Sep 5, 2019

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 :)

Loading

@malbonesi malbonesi deleted the feature/debug-bundle-ignore-actions branch Sep 5, 2019
@HenrikJoreteg
Copy link
Owner

@HenrikJoreteg HenrikJoreteg commented Sep 5, 2019

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.

Loading

@malbonesi
Copy link
Contributor Author

@malbonesi malbonesi commented Sep 6, 2019

Yeah right on. Thanks :)

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants