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

feature: ignore warnings when a target or source is not found #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukasberanek-tpa
Copy link

Pretty self-explanatory:
ignore console.warn in case the target or source is not found.

@pierpo
Copy link
Owner

pierpo commented Nov 6, 2023

Hey! Thank you for the contribution.
I wonder if this is the right approach. Maybe we should have a dev mode and a prod mode that ignores warnings?

I'm not sure about the feasibility of a dev mode/prod mode for a library though. I'm not sure we can use process.env.NODE_ENV in all cases 🤔 (it assumes that people are bundling the lib - which is probably always the case haha)

@lukasberanek-tpa
Copy link
Author

Unfortunately this won't fix my "problem":
I have two tables next to each other with multiple pages that I can click through. A row from one table can be connect to multiple rows in the other table. The problem is that these can be "hidden" in another page of the other table. Therefore I just create the relations in the first table without checking if they are actually visible in the other table.

@pierpo
Copy link
Owner

pierpo commented Nov 8, 2023

In that case, maybe we should ignore all warnings by default, and set a isDebug context with a props on ArcherContainer once, defaulting to false. That would make more sense :)

It's a breaking change though, but a minor one.

@lukasberanek-tpa
Copy link
Author

I actually think that the warning is a good indicator for the majority of use cases. Obviously I found one where it's not desired :)

Maybe we have to combine our suggestions by adding

isDebug: props.isDebug ?? process.env.NODE_ENV !== "production"

on the context.
This combines both:

  • overriding via isDebug={false} in the props (like I would do)
  • only show warnings during development

What do you think?

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

Successfully merging this pull request may close these issues.

None yet

2 participants