Skip to content
This repository was archived by the owner on Sep 6, 2018. It is now read-only.

These params can't be found in STATE or your Class: #5

Closed
robframpton opened this issue Mar 22, 2017 · 8 comments
Closed

These params can't be found in STATE or your Class: #5

robframpton opened this issue Mar 22, 2017 · 8 comments

Comments

@robframpton
Copy link

If I have class A, that extends class B, and the soy template for A implements STATE params from B it will show the following error.

These params can't be found in STATE or your Class:

The parent class needs to be resolved and parsed as well. Obviously that makes things a lot more complicated :)

@mthadley
Copy link
Collaborator

My immediate thought is that we could just skip validation for classes that do not extend directly from Component, since we can't be sure what the developer is doing. In the future, it would be nice if we could do all those things you mentioned, though.

@mthadley
Copy link
Collaborator

So with c362df8, we will just skip those files for now until we can find a better solution.

@jbalsas
Copy link
Contributor

jbalsas commented Jul 28, 2017

After #9, I also got hit by this now...

File - packages/clay-link/src/ClayLink.soy

     These params can't be found in STATE or your Class:
     
     elementClasses

Also, is there a typo in the message, where it should say STATE of your Class?

We can't ignore all the files, though 😂

Now that we have .soycriticrc, maybe we could have something like this?

{
    // Been toying with other names such as `classTemplateParams`, `classState`... 
    // Not sure what would be a good name for this
    "renderState": {
        "Component": ["elementClasses", "visible"]
    }
}

@mthadley
Copy link
Collaborator

It's actually just a bad message on my part. I'm trying to say it can't be found in STATE or as a method of your class. I need a wordsmith here, quick! 😄

Yea, I'm open to something like that. A default set of STATE attributes.

@jbalsas
Copy link
Contributor

jbalsas commented Jul 28, 2017

My first instinct was to go with some globals à la eslint

{
    "globalParams": ["elementClasses", "visible"]
}

That would of course be easier to implement but also more prone to error since it disregards the inheritance chain completely. Maybe something like:

{
    "implicitParams": {
        "Clay*": ["elementClasses", "visible"],
        "OtherTemplate": ["foo", "bar"]
    }
}

What do you think?

@mthadley
Copy link
Collaborator

@jbalsas I really like this idea. Let's go with it.

@mthadley
Copy link
Collaborator

mthadley commented Sep 7, 2017

@jbalsas @Robert-Frampton Are there any use cases not covered by the new implicitParams configuration? Can this be closed now?

@jbalsas
Copy link
Contributor

jbalsas commented Sep 8, 2017

Based on deprecate/metal-clay-components#65 it looks like we can... ☺️

@jbalsas jbalsas closed this as completed Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants