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

can-import can-tag fails silently when tag does not exist - P(4) ~5 #2

Closed
justinbmeyer opened this issue May 22, 2016 · 2 comments
Closed
Assignees
Labels

Comments

@justinbmeyer
Copy link
Contributor

From: canjs/canjs#1859

<can-import from="app/component/" can-tag="app-loading">
          <app-component></app-component>
</can-import>

If app-loading is not already imported, can-import will fail without throwing an error. It never renders app-component.

@justinbmeyer justinbmeyer changed the title can-import can-tag fails silently when tag does not exist can-import can-tag fails silently when tag does not exist - P(4) ~5 May 22, 2016
@Macrofig Macrofig self-assigned this Sep 27, 2017
@Macrofig
Copy link
Contributor

Found the unique use cases that cause this behavior

In all these use cases, the desired tag has not been previously registered with can-view-callbacks (specifically using this signature)

Special Characters

<can-import from="app/component/" can-tag="app-loading">
          <app-component></app-component>
</can-import>

No error is thrown and app-component never renders.

Solution

  • Log an error using can-util.dev when attempting to load a tag that has not been registered.
  • Render the content of can-import when promise is resolved

No Special Characters

can-component allows this but logs a warning.

<can-import from="app/component/" can-tag="loading">
          <app-component></app-component>
</can-import>

An error is thrown because can-view-callbacks.tag returns undefined and can-view-import expects a function. Also, app-component never renders.

Solution

  • Log an error using can-util.dev when attempting to load a tag that has not been registered.
  • Render the content of can-import when promise is resolved

Actual Implementation

  • Check if tag exists or is valid
  • If not valid/not exists, log warning
  • It not valid/not exists, render content of can-import as if can-tag property did not exist.

The warning logs were resolved yesterday. Checking today how difficult it will be to render content when cat-tag value is invalid.

@phillipskevin
Copy link
Contributor

closed by #57.

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

No branches or pull requests

3 participants