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

should itemToContent and datasetToContent return an instance of a HubContent class? #672

Open
tomwayson opened this issue Oct 21, 2021 · 0 comments

Comments

@tomwayson
Copy link
Member

They currently return a mutable POJO, but the problem is that many of its properties should really be computed as they depend on other properties. For example content.type is effectively this.layer.type || this.item.type.

We get into trouble when the dependent properties are set before their dependences. In the above example, for private items, we don't have this.layer for private items until we've fetched the server info, so we need to remember to update type an anything else that depends on layer, or the updated type, and so on. This has been the cause of a few sublte bugs.

See #667 (comment) for a description of how that PR introduced seter functions to mitigate such bugs.

If we stick w/ the current functional approach, it may be an improvement to make the returned POJOs immutable using something like deepFreeze. We are already trying to treat them as such since many

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

1 participant