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

Handle expansion of complex transitive reactive hints #626

Open
stephenh opened this issue Apr 23, 2023 · 1 comment
Open

Handle expansion of complex transitive reactive hints #626

stephenh opened this issue Apr 23, 2023 · 1 comment

Comments

@stephenh
Copy link
Collaborator

stephenh commented Apr 23, 2023

Given a non-persisted async property like Book.owner:

class Book {
  readonly owner: AsyncProperty<Book, Author | Publisher> = hasReactiveAsyncProperty(
    { author: ..., publisher: {} },
    return ...business logic choses either author or publisher...;
  });
}

And another reactive async property like Book.ownerName:

class Book {
  readonly ownerName: AsyncProperty<Book, string> = hasReactiveAsyncProperty(
    { owner: "name" },
    return owner.name;
  });
}

When a 3rd property wants to reactively depend on Book.ownerName, how do we expand the "owner" reactive hint into the correct reactive hint?

Specifically b/c owner's reactive hint may need the new "name" extension added to multiple places (for Author.name or Publisher.name) which may or may not be leaf properties in the hint.

Also, at runtime we only know that we need to add a "name" hint somewhere within the owner hint; we currently don't know that owner only returns Author | Publisher, to at least look for the subset of hint locations that match those entity types.

@stephenh
Copy link
Collaborator Author

Interesting example where both the ITIs returned from the variantsOfItem hint but also the "this" iti itself, both would need to be reactive:

  readonly variantsAndSelf: Collection<ItemTemplateItem, ItemTemplateItem> = hasManyDerived("variantsOfItem", {
    get: (iti) => [iti, ...iti.variantsOfItem.get],
  });

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