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

Properties on Lists? #999

Open
karger opened this issue Nov 25, 2023 · 3 comments
Open

Properties on Lists? #999

karger opened this issue Nov 25, 2023 · 3 comments

Comments

@karger
Copy link
Collaborator

karger commented Nov 25, 2023

Splitting mv-list and mv-list-item creates a new opportunity---or a new opportunity for messing up. It is now possible to define a property inside the mv-list but outside the mv-list-item. Mavo does not currently handle this well. https://codepen.io/pen?template=gxPjmz&editors=1100#0 . I think it completely ignores the property definition. There certainly doesn't seem to be a way to access it.

But actually, as in js, it is theoretically reasonable to have a list that also has other properties than the list-item 1...n properties. Do we want to support this in mavo. or will it make our novice programmers' heads hurt? If not, perhaps there should be an exception thrown if someone defines a property in this wrong place.

@DmitrySharabin
Copy link
Member

https://codepen.io/pen?template=gxPjmz&editors=1100#0.

@karger It looks like you copied the Codepen URL before saving it, so it's broken. Could you please update it?

@LeaVerou
Copy link
Member

LeaVerou commented Jan 4, 2024

The downside is that this does not translate to JSON, so we lose the ability to represent any Mavo data model with JSON. We could of course use some kind of convention to represent these, but it's more clumsy. But we generally don't add functionality because it seems cool, do we have use cases for this?

@karger
Copy link
Collaborator Author

karger commented Jan 4, 2024

Looks like I never saved it, so here is a new one https://codepen.io/karger/pen/Yzgwjbz?editors=1100 .
I think I discovered this by accidentally putting a property in the wrong place. Even if we don't support it we should handle it properly. E.g. report an error.

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

No branches or pull requests

3 participants