Not possible for injectors to reuse injected instances.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 838
- Forks
- 123
- Avg merge
- 7h 58m
- Merged PRs (30d)
- 12
Description
Given an IDependencyInjector for a type A and an IDependencyInjector for a type B which depends on an instance of A and a route that takes both injected parameters it's not currently possible for B's IDependencyInjector.injectValue to get the same instance of A that was injected directly into the route.
This is because although the router that invokes dependency injection records the injected value it does so into a copy of routeParams and does not subsequently invoke injectValue with the modified copy of routeParams.
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 in src/klein/_requirer.py at lines 205-208 and trace how the router records injected values in routeParams before invoking injectValue. Ensure a dependent injector can receive the same A instance already injected directly into the route; done means B's injector reuses that instance rather than receiving a separate one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100