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

Add a docs link to the “Unable to find” warnings #282

Open
chasenlehara opened this issue Aug 29, 2017 · 1 comment
Open

Add a docs link to the “Unable to find” warnings #282

chasenlehara opened this issue Aug 29, 2017 · 1 comment

Comments

@chasenlehara
Copy link
Member

chasenlehara commented Aug 29, 2017

@frank-dspeed commented on Mon Jul 24 2017

Hi, when I write something like:
<h3 class="userCard-userName">{{currentPerson.firstname}} {{currentPerson.lastname}}</h3>
I have a warning in console:
WARN: can-stache/src/expression.js: Unable to find key or helper "currentPerson.imageUrl".
It doesn't break anything, but annoys a bit. Besides currentPerson is in viewModel, what exactly wrong with {{currentPerson}} notation, because I think I have the same warning in other places when show some info on the page.

The Warning could stay as is but we add https://canjs.com/faq#expression-warnings

The content would be something like:
This warning happens sometimes when you do not try to read it (imgUrl) in a stache Template but its set on a property of defineMap as property

Based on this, I think it would be useful if we added docs to canjs.com with common scenarios where this might happen and how to fix it, then include a link to those docs wherever this kind of warning appears.

@chasenlehara chasenlehara changed the title Proposal: create a FAQ Page on canjs.com Add a docs link to the “Unable to find” warnings Aug 29, 2017
@chasenlehara
Copy link
Member Author

This search shows all(?) of the “unable to find” warnings: https://github.com/search?q=org%3Acanjs+%22Unable+to+find%22&type=Code

I think helper, key, and partial are the three main types we make warnings for. Here’s a CodePen with some examples: https://codepen.io/chasenlehara/pen/mZbYPN?editors=1011

For each place we generate warnings, I think it’d be helpful to include a link to the docs on what the error means and how it can be fixed. Here are some examples of warnings where we link to the docs: https://github.com/search?o=desc&q=org%3Acanjs+%22https%3A%2F%2Fcanjs.com%22+warn&s=indexed&type=Code

Here are some common issues:

  • All three types: misspellings
  • Helpers & partials: defined in a separate file that hasn’t been imported
  • Keys: not defined on the VM or not defined on an object (e.g. the obj object not having prop defined on it so obj.prop gives a warning)

I’m not sure where these docs should go… some ideas:

  1. A “common warnings” section in the main can-stache docs: https://canjs.com/doc/can-stache.html

  2. A warnings section in the API pages for {{expression}} and {{> partialName}}.

  3. A warnings section in each of the KeyLookup expressions and Helper expressions docs.

  4. …?

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

No branches or pull requests

2 participants