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: morph/react ignore data slots from view's props #254

Closed
wants to merge 1 commit into from

Conversation

alex-vladut
Copy link
Contributor

With this PR I try to solve this issue where data related slots appear in the view's props as unused variables: #242

I need this change because I'll try to reuse the mechanism for the design tokens, otherwise it will even lead to syntax errors as the design token slots now contain dots as well:

color <ds.colors.primary

will end up with some code like this:

View({
viewPath,
... // other props
ds.colors.primary
}){ 
...

There could be an edge case issue with the approach, but I'm not expecting it to be a problem at the moment as those isValid, onChange etc. keywords should be used only with data anyway. e.g.

Some View
  Block
  isValid < # this should be passed through props here
  Block
  data something
  isValid < # this will correspond to the "data.isValid"

This use case will not work with the approach I implemented here, as the slot won't appear in the props. I couldn't think of a better solution, but let me know please if you think this could be problematic and we could dig into that more. Thanks

@dariocravero
Copy link

Leaving a note for reference. After a session with @alex-vladut we realised that the syntax wasn't color <dt.colors.primary because that would name the slot as dt.colors.primary so instead, we need to do this:

# fixed color to a DS value
color dt.colors.primary
# color opened as prop with default to DS value
color < dt.colors.primary

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.

2 participants