Skip to content
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

Guard and url params #32

Open
zevenbergm opened this issue Jul 25, 2019 · 3 comments
Open

Guard and url params #32

zevenbergm opened this issue Jul 25, 2019 · 3 comments

Comments

@zevenbergm
Copy link

zevenbergm commented Jul 25, 2019

I've a JET view which has two plugins: UrlParam and UnloadGuard. The app is using the HashRouter. The issue is that when I click the browsers' back button the parameter is directly removed before it even hits the UnloadGuard.

The UnloadGuard is implemented as follows (in the init method):

this.use(plugins.UnloadGuard, args => {
      const form = this.$$("frm");

      if (form.isVisible() && form.isDirty()) {
        return webix
          .confirm({
            title: "Form is incomplete",
            text: "Do you still want to leave?"
          })
      }

      return true;
});
this.use(plugins.UrlParam, ["id", "canvasEntityId"]);

Example: The URL looks like '.../task/1'. After I click the browsers' back button the url looks like '.../task' and not awaits the UnloadGuard (as I expect).

How can I work around this? Any help is highly appreciated because I need this ASAP (as always...).

Thanks,
Martin

@zevenbergm
Copy link
Author

Is there an update on this issue?

@kullias
Copy link
Member

kullias commented Aug 14, 2019

Hi,

no, sorry, not yet. we will see to this issue.
If you have problems that need immediate attention, it is advisable to post a question to forum.webix.com. Have you tried it yet? This way you will get help much sooner. Issues in the repo are expected to be those that concern Webix Jet itself.

@HelgaListopad
Copy link
Contributor

@zevenbergm
Hi Martin,

Unfortunately, the described issue cannot be resolved so far.

After I click the browsers' back button the url looks like '.../task' and not awaits the UnloadGuard (as I expect).

The UnloadGuard fully covers the navigation triggered by Jet API, as in such case, the actual URL of the page will be changed respectively and can be easily maintained.

Still, the URL in the browser can be changed manually or with the buttons Back/Forward.
In such case, the URL is modified before the app reacts to it ( and, therefore, before the UnloadGuard gets involved ). Even if the UnloadGuard declined the navigation, the URL rendered in address bar stays changed. At the same time, the app hierarchy and UrlParams in the app config do not change. The URL params called as this.getParam("testProp"); will return the correct value which was set in the application.

We understand that this behaviour can be confusing and will consider the possible improvements for future updates, but for now, I'm afraid there is no feasible solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants