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

@HistoryPopState called multiple times

XMLWordPrintable

      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);
      	}
      

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

              Created:
              Updated:
              Resolved:

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