kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 193 forks source link

Feature Request: Defer hot-code-push until route-change #658

Open ghost opened 8 years ago

ghost commented 8 years ago

Why Hot code push causes my users to lose their incomplete form data that they have not submitted yet.

Use case

  1. On pages where I have a big form I call FlowRouter.deferHCP(); So that means FlowRouter will block any Hot Code Push attempts by the server, but flag that it needs to happen on the next route change.
  2. The user completes the form and I run FlowRouter.go() or they click a link to go to another page, or whatever. Now FlowRouter() runs a reload.

Sugar FlowRouter.deferHCP(); //defers HCP until next route FlowRouter.deferHCP({not:['localhost','192.168.0.200','foobartest.com']}); //Development remains quick and easy when accessing the server from test-machines but users accessing the public hostname eg: foobar.com HCP will be deferred so they don't lose their form state and stay happy.