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

fix(Container): Fix unmapped components silently do nothing #88

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

Conversation

samuelgomezvaltech
Copy link

@samuelgomezvaltech samuelgomezvaltech commented Dec 6, 2021

By doing console.warn when a child has a cqType not mapped to a component.

Description

console.warn when componentMapping.get(cqType here) finds no component mapped to that cqType.

Related Issue

#87

Motivation and Context

Thus helping developers to analyze scenarios where a component is not rendered.

The provided message is specific enough to help both when the cause of the issue is a missing/typo'ed MapTo and when is not (no rendering && not this message --> mapping is ok --> focus on other possible causes).

How Has This Been Tested?

Unit test is provided. Node.js version used was v14.17.3. No higher since that would bump the package-lock.json lockfileVersion.

Screenshots (if appropriate):

Resulting warning message in the console:

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

By doing console.warn when a child has a cqType not mapped to a component.

Thus helping developers to analyze scenarios where a component is not rendered.
@friendlymahi
Copy link
Contributor

@samuelgomezvaltech - I was looking for something like this a while back and endedup writing a wrapper component that does the check for me. However I suggest a small change. Please add the warnings only when it is inEditor, this way there is no need for end users to be aware of this behavior. See if this makes sense. Thanks !

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