afterEnter hook triggers wrong namespace
See original GitHub issueThe problem
When using the views, the afterEnter hook fires on the previous page and not the page that I’m navigating to.
Description
Details
I’m navigating from work to index, and have an afterEnter
hook on both of them. When entering index, the hook that get’s called is the afterEnter
on the work namespace.
Expected behaviour
Was expecting that the afterEnter
hook would be called on the index namespace.
Actual behaviour
The afterEnter
hook on the work namespace that I’m leaving is being called.
Code To Reproduce Issue [ Good To Have ]
barba.init({
transitions: [{
enter: (data) => {
console.log("current namespace", data.current.namespace);
console.log("next namespace", data.next.namespace);
}
}],
views: [
{
namespace: 'sz-index',
afterEnter(data) {
console.log("sz-index");
}
},
{
namespace: 'sz-work',
afterEnter(data) {
console.log("sz-work");
}
}
]
})
Steps to reproduce issue [ Good To Have ]
Run the above code and the following will be printed to the console;
[Log] current namespace – "sz-work" (bundle.js, line 12311)
[Log] next namespace – "sz-index" (bundle.js, line 12311)
[Log] sz-work (bundle.js, line 12311)
Environment
- Barba version that exhibits the issue: 2.0.1-next.97+33c213b
- Build used:
- module (esm/)
- browser (dist/)
- main (lib/)
- Browser OS/version used: Safari Version 12.1 (14607.1.35.1)
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
barba/core - BarbaJS
A mode that indicates whether leave and enter hooks should “play together”. This involves waiting until the next page is available (fetched or...
Read more >PropertyChangedTrigger doesn't work - wrong namespace?
Triggers>. When building the project, Expression Blend throws following error: The tag 'DataStoreChangedTrigger' does not exist in XML ...
Read more >your sitemap or sitemap index file doesn't properly declare the ...
Is this the error: Your Sitemap or Sitemap index file doesn't declare the expected namespace: http://www.sitemaps.org/schemas/sitemap/0.9 Parent tag: urlset ...
Read more >Wael Yasmina | Barba.js V2 Tutorial For Total Beginners
Each object represents a view and it contains the namespace of the container in addition to a subset of transition hooks which are,...
Read more >Integrator Guide - Corteza Docs
Combination of automation triggers, meta data and the code itself, ... They can be used to implement new routes on the API, such...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
🙏 But, no community, no support, no great tool… 😁
@OksanaRomaniv I don’t think that the update is already available in the stable release.
Anyway you can install one of the release tagged in next. Right now the newest is
2.1.1-next.103
. Either update your package.json with that version or run:yarn add @barba/core@next
(npm install @barba/core@next
if you’re using npm)