InlineViewStrategy on ready not used, causing InlineViewStrategy to be slower than ConventionalViewStrategy
- Dominant language
- TypeScript
- Stars
- 113
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
**I'm submitting a bug report**
* **Library Version:**
1.3.0
* **Browser:**
all
* **Language:**
all
**Current behavior:**
At the moment InlineViewStrategy doesn't reuse the TemplateRegistryEntry during loading until the factory is ready. This happens e.g. if you compose multiple view models with inline view strategy and use a repeat:
```
```
```
getViewStrategy() {
//Note I'm creating one view strategy per template here, this is just a simplification, as I have a service for this
if (strategy) {
return strategy;
}
strategy = new InlineViewStrategy('...');
return strategy;
}
```
Whereas when you use e.g. the ConventionalViewStrategy or the RelativeViewStrategy it returns the same promise of the TemplateRegistryEntry and uses it again. (onReady in view engine's loadViewFactory)
**Expected/desired behavior:**
I have a table cell with a dynamic view but different view categories, so in the end it's like a couple of different html templates that get used. I would expect it to be about the same performance as with using custom elements with fixed views and an switch case in the template (which is a lot faster atm).
So I investigated and found out one issue that it never goes into onReady case or factoryIsReady case for InlineViewStrategy. (Want to do further investigation)
If you change the inline view strategy above to reuse the entry if it's already used and create one distinct inline view strategy object for each template type it improved render time for me for 1000 cells from 8 seconds to about 5 seconds. (ConventionalViewStrategy also 5 seconds)
**Suggested fix:**
As I'm quite new to aurelia I don't know if changing the inline view strategy to reuse the TemplateRegistryEntry will break something. At least in the other view strategies it is reused.
Contributor guide
Research direction
Start with InlineViewStrategy and the view engine's loadViewFactory method, focusing on the onReady and factoryIsReady paths and how other view strategies reuse TemplateRegistryEntry. Reproduce the repeated inline compose case with 1000 cells, then verify that reuse improves rendering without breaking distinct inline templates or existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100