samie / Idle

Idle - User inactivity tracking for Vaadin
https://vaadin.com/directory/component/idle
Apache License 2.0
7 stars 1 forks source link

Inactivity timeout switches to default value after page refresh #1

Closed maxschuster closed 10 years ago

maxschuster commented 10 years ago

The inactivity timeout becomes 5000 after a page refresh if the UI is annotated with @PreserveOnRefresh. This happens because the javascript function "setInactivityTimeout" is only called in the method "setTimeout"

samie commented 10 years ago

You're right about this. However, the correct way to fix would probably be to use state variable for the timeout value. Then it would not revert to default 5000ms on page refresh even with @PreserveOnRefresh turned on. I'll take a look.

maxschuster commented 10 years ago

I was thinking about using a state, too, but I was a bit confused by the location of the widgetset (org.vaadin.addons.useractivitytracker). If I create an IdleState should I put it into org.vaadin.addons.useractivitytracker.client or move the widgetset to org.vaadin.addons.idle?

maxschuster commented 10 years ago

I have moved the timeout property into the shared state by moving the widgetset to org.vaadin.addons.idle: https://github.com/maxschuster/Idle/commit/f4518e89259066e5084fd370625b6834ff418c8d I can create another pull request if you want.

samie commented 10 years ago

Yes, great. Even it now need ws compilation, this looks pretty much the "right way".