angular / preboot

Coordinate transfer of state from server to client view for isomorphic/universal JavaScript web applications
MIT License
382 stars 51 forks source link

question: a clicks by default event selector #109

Closed stephenlautier closed 4 years ago

stephenlautier commented 4 years ago

This is more a question (at first) may be a "feature" if it makes sense.

Is there any reason why the following is not a default? and more importantely does it make sense?

// when user clicks link (a href)
{
  selector: "a",
  events: ["click"],
  preventDefault: true,
  replay: true
}

The issue is (and this is the main reason why I'm trying to integrate preboot), when the app is rendered in SSR and the user clicks on a link (especially on a slow device/app) each click will navigate and trigger a new whole page reload; And if the user keeps on clicking before the app actually loads on client, it will keep on doing full reloads which results in a very bad experience

CaerusKaru commented 4 years ago

The reason is that this is actually desirable behavior in a lot of applications. This gives the app some usability in its initial stage as opposed to being a blank, non-interactive page. It's actually frustrating to users to have elements that should be clickable, but in actuality do nothing.