Conversation
Contributor
|
Is there a reason you didn't simply use so-called "raw values"? |
Author
|
@disruptek The reason is that I have a lot of computed properties, so I would like to "group" them within separate models where the models containing the "raw values" serve as dependencies, rather than the "raw values" itself. |
Contributor
|
I understand the schema; I just would have hacked it together more explicitly using the mechanics we already have. That said, this seems like a pretty harmless change that opens up potential for this and other (magical) use cases. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a model has computed properties, it's only possible to specify dependencies that are attributes to that model. However, I have a case where it would be useful to do something like this:
It can be more or less compared to the concept of binding sources with Views.
I don't think that this should be integrated into Epoxy itself, but I found out that it's easy to implement this myself if the modelMap that Epoxy uses to define dependencies for computed properties was exposed. Right now this is a private variable in the Epoxy library which can't be accessed from outside the library. If it was possible to access it - for example as Epoxy.modelMap - I could implement the functionality described above by overriding the get method as
I fully understand why in principle the modelMap should be a private variable - you don't want other people to mess with how the library works internally - but I think that it can be useful to have the opportunity to access it if one wants to extend Epoxy.