Nativescript: TabView State not maintained while using HMR

Created on 17 Oct 2018  路  5Comments  路  Source: NativeScript/NativeScript

Environment

  • CLI: 5.0.0-2018-10-16-12488
  • Cross-platform modules: 5.0.0-rc-2018-10-16-182917-07
  • Android Runtime: 5.0.0-rc-2018-10-15-143937-09
  • iOS Runtime: N/A
  • Plugin(s): N/A
  • Dev-webpack: 0.17.0-rc.0

Description
HMR is not maintaining the state of TabView.

To Reproduce
Open any tab other than the first tab of a TabView Layout, and make some changes to that file,
when you save the file, after HMR does its thing, the TabView always switches to the first tab.

Expected behavior
The TabView's state should be maintained as it is.

Sample project
hmrDemo.zip

enhancement tab-view

Most helpful comment

HI @shiv19,
Thank you for the provided sample project. I was able to recreate the case. We will investigate further this issue and will provide more info.
Related to issue #6398

All 5 comments

HI @shiv19,
Thank you for the provided sample project. I was able to recreate the case. We will investigate further this issue and will provide more info.
Related to issue #6398

Any progress on this? I'm experiencing even more problems after the NS 5.3 update. Prior to that, all I had to do when HMR was having problems was to restart the app. Now I need to cancel the terminal session and rerun tns run ios --hmrto even see my changes.

Hey @shiv19 and @patrikengborg,

This has been implemented for NativeScript applications with JavaScript and TypeScript:

The improved behavior consists of handling updates on View level which allows:

  • preserving application state when not only Frame, but alsoTabView and SideDrawer (any View successor) are application roots
  • applying changes per module, without performing navigation
  • detect updates on app root module and reset application content

I'm still having quite extensive problems with TabView and HMR, as described in my comment above. The provided answer was promising, but sadly didn't make much of a difference after trying out tns-core-modules@next

Has this been tested in NativeScript Vue? I forgot to mention that's what I'm using.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rogangriffin picture rogangriffin  路  3Comments

NickIliev picture NickIliev  路  3Comments

NordlingDev picture NordlingDev  路  3Comments

Pourya8366 picture Pourya8366  路  3Comments

valentinstoychev picture valentinstoychev  路  3Comments