Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

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

@tomwayson

Description

@tomwayson

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions