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

[context] What is the use case for one-off requests? #54

Open
mattlucock opened this issue Dec 9, 2023 · 0 comments
Open

[context] What is the use case for one-off requests? #54

mattlucock opened this issue Dec 9, 2023 · 0 comments

Comments

@mattlucock
Copy link

mattlucock commented Dec 9, 2023

I think for many people (including me), the intuitive idea of a context is that a consumer, simply by virtue of existing under a provider, should have the provider's value; I think a lot of people would think of this as an invariant that contexts should obey. But the idea of a one-off context request (as opposed to a subscription request) inherently contradicts this, since the consumer immediately falls out-of-sync with the provider when the context changes. Effectively, it feels like the consumer was never really 'in the context' of the provider to begin with.

This might seem trivial, since if a consumer wanted to stay in-sync, it should have asked the provider to keep it in-sync. But my question is: why wouldn't a consumer want to stay in-sync? Why would a consumer want to behave in this way? Again, it feels contradictory to the very idea of contexts; it's not apparent to me that it makes conceptual sense.

@lit/context actually defaults to making one-off requests, which very much implies there is a good use case for them, but none of the code examples seem to motivate this. I expect I may be missing something obvious, so I would appreciate it if anyone can shed light on this.

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