aurelia / aurelia/framework

Problems with using @useView() but getViewStrategy() works

Open
#695 2 comments 0 reactions 0 assignees View on GitHub
bug question
Dominant language
TypeScript
Stars
11.7k
Forks
608
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a bug report**

* **Library Version:**
1.0.7

**Please tell us about your environment:**
* **Operating System:**
Windows 2016 Server

* **Node Version:**
7.4.0

* **NPM Version:**
4.0.5

* **JSPM OR Webpack AND Version**
webpack 2.2.0-rc.3

* **Browser:**
Chrome 55

* **Language:**
TypeScript 2.1.5

**Current behavior:**
Ok, it is hard for me to explain this. I have a sidebar with tabs on top. Each tab opens a different composed view in this sidebar.
``
So clicking on a tab, gets the data for that tab and populates the tabModel object.
If I have pairs of vewModel/view (ie. lampPostEdit.ts/lampPostEdit.html) works fine.
But if I extract an abstract super-class of viewModel that all veiwModels on the sidebar extends and I put @useView('vewName') on the concrete class then in runtime i click on tabs, what happens is that the view is correctly rendered the first time, but not the sequent time.
If I instead of @useView use getViewStrategy(), all works fine.

**Expected/desired behavior:**

To work like getViewStrategy().
So if I have a concrete viewModel extending the baseView, and @useView() is declared on the concrete viewModel, it should display its view correctly each time.

* **What is the expected behavior?**

* **What is the motivation / use case for changing the behavior?**
The motivation for me is to extract common viewModel logic into it's superclass, and have each concrete viewModel assigneds it's view by using @useView() attribute.

Contributor guide

Open the contributing guide

Research direction

The report names no repository files or runnable reproduction; start by locating the @useView decorator, getViewStrategy(), and compose handling, then reproduce the repeated tab selection with a concrete TypeScript view-model extending a superclass. Compare the view strategy selected on the first and subsequent renders, and consider the issue done when the concrete view is rendered correctly each time as described.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.