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

Updating normalizerConfig after initial render #38

Open
iamJoeTaylor opened this issue Feb 6, 2025 · 5 comments
Open

Updating normalizerConfig after initial render #38

iamJoeTaylor opened this issue Feb 6, 2025 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@iamJoeTaylor
Copy link

It would be awesome if there was a way to update the config normalizerConfig specifically for my current needs devLogging after the initial render.

I'd like to expose this in an admin panel so admins can turn on logging if needed.

I'm currently using the react-query variant of Normy if it makes a difference.

@klis87 klis87 added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Feb 7, 2025
@klis87
Copy link
Owner

klis87 commented Feb 7, 2025

I think we could do this. I wanted to be sure though, is it necessary for you only in development? Because like mentioned at https://github.com/klis87/normy/tree/master?tab=readme-ov-file#debugging-arrow_up , typically this is not meant to be used in production

@iamJoeTaylor
Copy link
Author

Ah I did miss that line;

Note that this works only in development, even if you pass true, no logging will be done in production (when precisely process.env.NODE_ENV === 'production'). NODE_ENV is usually set by module bundlers like webpack for you, so probably you do not need to worry about setting NODE_ENV yourself.

I was interested in logging in Prod for Admins only. But it's not a super important feature for me.

@klis87
Copy link
Owner

klis87 commented Feb 11, 2025

In theory we could also make it configurable to allow it on production. However, I wonder if this did not spam your logs on production :) It would cause tons of logs.

Anyway, this feature was exposed mostly as curiocity, so that developers could see what is really done by Normy under the hood, and... to debug some problems if they arise etc.

@iamJoeTaylor
Copy link
Author

Anyway, this feature was exposed mostly as curiocity, so that developers could see what is really done by Normy under the hood, and... to debug some problems if they arise etc.

These logs have extremely helpful.

In theory we could also make it configurable to allow it on production. However, I wonder if this did not spam your logs on production :) It would cause tons of logs.

No worries if you'd like to leave as is. Always a tradeoff of complexity.

@klis87
Copy link
Owner

klis87 commented Feb 11, 2025

is your setup broken in production if you use NODE_ENV !== 'production' ? If it is ok, then you would have those logs in production. And epxosing update of this config dynamically would be very easy then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants