Skip to content

Commit 595d2a0

Browse files
committed
fix: fix HMR issue on Android (nativescript-vue#461)
1 parent d847a36 commit 595d2a0

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

platform/nativescript/runtime/components/frame.js

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -158,32 +158,12 @@ export default {
158158

159159
// replace the controllers instead of pushing directly
160160
frame._ios.controller.setViewControllersAnimated(newControllers, false)
161-
} else {
162-
const frameId = frame._android.frameId
163-
frame._isBack = false
164-
backstackEntry.frameId = frameId
165-
166-
const manager = frame._getFragmentManager()
167-
const currentEntry = frame._currentEntry
168-
169-
const newFragmentTag = `fragment${frameId}[-1]`
170-
const newFragment = frame.createFragment(backstackEntry, newFragmentTag)
171-
const animated = false
172-
const navigationTransition = null
173-
174-
const transaction = manager.beginTransaction()
175-
_setAndroidFragmentTransitions(
176-
animated,
177-
navigationTransition,
178-
currentEntry,
179-
backstackEntry,
180-
transaction,
181-
frameId
182-
)
183-
transaction.remove(currentEntry.fragment)
184-
transaction.replace(frame.containerViewId, newFragment, newFragmentTag)
185-
transaction.commitAllowingStateLoss()
186161
}
162+
// Note: in the Android platform there is nothing to do, as the
163+
// page is able to change without the need of replacing the last
164+
// navigation entry
165+
166+
// reset HMR checking flag
187167
resetHMRChecking()
188168
},
189169

platform/nativescript/runtime/components/list-view.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default {
5151

5252
mounted() {
5353
if (!this.$templates) {
54-
return;
54+
return
5555
}
5656

5757
this.$refs.listView.setAttribute(
@@ -69,9 +69,9 @@ export default {
6969
},
7070
onItemLoading(args) {
7171
if (!this.$templates) {
72-
return;
72+
return
7373
}
74-
74+
7575
const index = args.index
7676
const items = args.object.items
7777

0 commit comments

Comments
 (0)