veliovgroup / flow-router

🚦 Carefully extended flow-router for Meteor
https://packosphere.com/ostrio/flow-router-extra
BSD 3-Clause "New" or "Revised" License
202 stars 29 forks source link

Force `Router.update()` #76

Closed MaxmaxmaximusGitHub closed 8 months ago

MaxmaxmaximusGitHub commented 4 years ago

I added a route 1 second after loading the page, how can I call the method. Router.update () so that it checks for which route the current ur is suitable for?

MaxmaxmaximusGitHub commented 4 years ago

it doesn't suit me:

FlowRouter.wait();
WhenEverYourAppIsReady(() => {
  FlowRouter.initialize();
});

i need like this

    add: (page)->
        @pages.push(page)

        FlowRouter.route page.href,
            name  : page.name,
            action: => @activate(page)

        FlowRouter.update() # i need like this
        return
dr-dimitru commented 4 years ago

@MaxmaxmaximusGitHub thank you for this suggestion. Adding a feature to initialize routes on the fly (during runtime) will require major changes. As right now we have stable and old codebase inherited from original package with many flaws, I'm keeping this feature open for next major v4 release

dr-dimitru commented 2 years ago

@MaxmaxmaximusGitHub looks like there's actually a trick to pull new routes dynamically, and it was used in our tests for a long time

After new routes passed into FlowRouter.route() method:

const reloadRoutes = () => {
  FlowRouter._initialized = false;
  FlowRouter.initialize();
}
dr-dimitru commented 8 months ago

Trick from comment above should sole this issue

@MaxmaxmaximusGitHub Feel free to reopen it in case if the issue is still persists on your end.