[labs/context] Allow multiple provider contexts to be added at the same time
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 21.8k
- Forks
- 1.1k
- Avg merge
- 18h 25m
- Merged PRs (30d)
- 2
Description
### Should this be an RFC?
- [X] This is not a substantial change
### Which package is this a feature request for?
Context (@lit-labs/context)
### Description
It would be useful to be able to provide multiple contexts at the same time; allowing a provider component to be instantiated the same way but with a dynamic array of contexts
```js
private provider = new MultiContextProvider(this, [
[loggerContext, {
log: (msg) => {
console.log(`[my-app] ${msg}`);
},
}],
[themeContext, myTheme],
[apiContext, myAPI],
]);
```
### Alternatives and Workarounds
It's possible to create a separate provider for every injected service.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the @lit-labs/context provider implementation and its existing Provider API. Add support for constructing one provider with an array of context/value pairs, and verify that multiple injected services can be provided together without requiring separate providers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100