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

Option to force on in production #48

Closed
adamscybot opened this issue Aug 7, 2019 · 3 comments
Closed

Option to force on in production #48

adamscybot opened this issue Aug 7, 2019 · 3 comments
Labels
Feature New feature or request

Comments

@adamscybot
Copy link

adamscybot commented Aug 7, 2019

At the moment, the exchange is a no-op when NODE_ENV is production. There are use cases where you want to keep this enabled in prod -- to analyse the requests/responses.

We could change the API of the exchange to be a higher order function that accepts a new config option enabled?: boolean which defaults to NODE_ENV !== 'production'.

This will allow people to control when the exchange is and isn't in affect.

Willing to PR if you think this is a good idea.

@andyrichardson
Copy link
Collaborator

@adamscybot this is a fair point.

Your suggestion of a HOF sounds like a strong idea. Get a PR open and we'll get this merged 👍

@andyrichardson andyrichardson added the Feature New feature or request label Aug 7, 2019
@adamscybot
Copy link
Author

adamscybot commented Aug 8, 2019

Actually, thinking about this again, would it better to just remove the checks entirely and defer this to userland? E.g. the user simply puts a conditional in their exchanges array .

I think this removes any elements of surprise and it doesn't set a precedence. It also means we don't have a no-op pipe there when its off.

@JoviDeCroock
Copy link
Contributor

We're open for a PR to do this in @urql/devtools. The thing is that in Production you'll be lacking display names for your components since you are minified anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants