framework icon indicating copy to clipboard operation
framework copied to clipboard

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

Open cluka opened this issue 8 years ago • 2 comments

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. <compose viewModel.bind="tabModel.ViewModel" model.bind="tabModel.model"></compose> 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.

cluka avatar Jan 17 '17 19:01 cluka

Another one I think is connected to this is: is I use "useView('viewName')" my navigation is not working. So if I open the view than in it i do router.navigateToRoute('routeName') it does change the url but not the viewmodel/view. Again all works fine if I use "getViewStrategy()"

cluka avatar Feb 16 '17 13:02 cluka

@cluka Thanks for filing this bug. May I know if tabModel.ViewModel is a function (class constructor) or an object? I think this has already been fixed, but I'm not sure about your usage.

bigopon avatar Jan 29 '19 10:01 bigopon