reactioncommerce / reaction-feature-requests

Reaction Feature Requests
13 stars 1 forks source link

Modifying custom routes requires database reset for changes to take effect #24

Open brent-hoover opened 6 years ago

brent-hoover commented 6 years ago

@Stat1c14 commented on Thu Apr 27 2017

When building a plugin with custom routes, the database must be reset in order for changes to route and template names to take effect.

Expected behavior

Editing custom routes in register.js should trigger a server restart and changes should take effect.

Actual Behavior

Changes only seem to take effect if the database is reset.

Steps to Reproduce the Behavior

Edit the name of a template in register.js and in that template file. Notice that the application still looks for the old template name even after server restart, meaning that the template name for that route must be stored in the database somewhere.

Running reaction reset -n updates to reflect your changes.

Versions

Max OSX Sierra 10.12.1 Node: 6.2.2 NPM: 4.0.5 Docker: 17.03.1-ce Reaction CLI: 0.8.0 Reaction: 1.1.1 Reaction Branch: master


@aaronjudd commented on Thu Apr 27 2017

I think this is/was a known issue. Two things come to mind there.. you can just delete the Packages collection instead of resetting the db, then reload will reimport. (so before you edit,save delete the running instance Packages collection). And also ReactionCore.Router._routesMap and ReactionCore.Router.Reload() should allow you to view and reload the router.