8000 fix(ssr): memory leak in poll method by ronald-d-rogers · Pull Request #2875 · vuejs/vue-router · GitHub
[go: up one dir, main page]

Skip to content

fix(ssr): memory leak in poll method #2875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension 10000

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(test): added coverage for out-in transition before route enter cb
  • Loading branch information
ronald-d-rogers committed Aug 10, 2019
commit f340981a4c943639dc30be0cd10e530801b8eebf
47 changes: 34 additions & 13 deletions examples/navigation-guards/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,25 @@ const Quux = {
}

const NestedParent = {
template: `<div id="nested-parent">Nested Parent <hr>
<router-link to="/parent/child/1">/parent/child/1</router-link>
<router-link to="/parent/child/2">/parent/child/2</router-link>
<hr>
<p id="bre-order">
<span v-for="log in logs">{{ log }} </span>
10000 </p>

<router-view/></div>`,
template: `
<div id="nested-parent">
Nested Parent
<hr>
<router-link to="/parent/child/1">/parent/child/1</router-link>
<router-link to="/parent/child/2">/parent/child/2</router-link>
<hr>
<p id="bre-order">
<span v-for="log in logs">{{ log }} </span>
</p>
<!-- #705 -->
<!-- Some transitions, specifically out-in transitions, cause the view -->
<!-- that is transitioning in to appear significantly later than normal, -->
<!-- which can cause bugs as "vm" below in "next(vm => ...)" may not be -->
<!-- available at the time the callback is called -->
<transition name="fade" mode="out-in">
<router-view/>
</transition>
</div>`,
data: () => ({ logs: [] }),
beforeRouteEnter (to, from, next) {
next(vm => {
Expand All @@ -116,7 +126,18 @@ const GuardMixin = {
}
}

const NestedChild = {
const NestedChild1 = {
props: ['n'],
template: `<div>Child {{ n }}</div>`,
mixins: [GuardMixin],
beforeRouteEnter (to, from, next) {
next(vm => {
vm.$parent.logs.push('child ' + vm.n)
})
}
}

const NestedChild2 = {
props: ['n'],
template: `<div>Child {{ n }}</div>`,
mixins: [GuardMixin],
Expand Down Expand Up @@ -162,10 +183,10 @@ const router = new VueRouter({
path: '/parent',
component: NestedParent,
children: [
{ path: 'child/1', component: NestedChild, props: { n: 1 }},
{ path: 'child/2', component: NestedChild, props: { n: 2 }}
{ path: 'child/1', component: NestedChild1, props: { n: 1 }},
{ path: 'child/2', component: NestedChild2, props: { n: 2 }}
]
}
},
]
})

Expand Down
8 changes: 8 additions & 0 deletions examples/navigation-guards/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<!DOCTYPE html>
<link rel="stylesheet" href="/global.css">
<style>
.fade-enter-active, .fade-leave-active {
transition: opacity .5s ease;
}
.fade-enter, .fade-leave-active {
opacity: 0;
}
</style>
<a href="/">&larr; Examples index</a>
<div id="app"></div>
<script src="/__build__/shared.chunk.js"></script>
Expand Down
0