Skip to content

Guard and url params #32

@zevenbergm

Description

@zevenbergm

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions