question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

afterEnter hook triggers wrong namespace

See original GitHub issue

The 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:closed
  • Created 5 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
thierrymichelcommented, Apr 1, 2019

🙏 But, no community, no support, no great tool… 😁

2reactions
dwightjackcommented, Apr 1, 2019

@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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found