Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4061

@HistoryPopState called multiple times

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 8.5.2.1
    • Fix Version/s: 8.6.0
    • Component/s: Databind 2
    • Security Level: Jimmy

      Description

      Steps to Reproduce

      run the example multiple-historyPopState.zul
      click the button a few times (pushes browser history states)
      navigate back
      observe the server logs

      Current Result

      the method handleHistoryPopState is called multiple times for the same history pop state event

      Expected Result

      handleHistoryPopState called once

      Debug Info

      the number how often the method is called corresponds to the number of root components on the page

      Workaround

      listen to onHistoryPopState with a @Command binding

      	<div viewModel="@id('vm') @init('zk.support.BrowserHistoryVM')"
      		onHistoryPopState="@command('handleHistoryPopState')">
              ...
      
      	@Command
      	public void handleHistoryPopState(@ContextParam(ContextType.TRIGGER_EVENT)
                                 final HistoryPopStateEvent event) {
      		final Object state = event.getState();
      		System.out.println(state);
      	}
      

        Attachments

        1. BrowserHistoryVM.java
          1.0 kB
          cor3000
        2. multiple-historyPopState.zul
          0.6 kB
          cor3000

          Issue Links

            Activity

              People

              Assignee:
              rudyhuang rudyhuang
              Reporter:
              cor3000 cor3000
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h