reactioncommerce / reaction

Mailchimp Open Commerce is an API-first, headless commerce platform built using Node.js, React, GraphQL. Deployed via Docker and Kubernetes.
https://mailchimp.com/developer/open-commerce/
GNU General Public License v3.0
12.34k stars 2.17k forks source link

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

Closed StaticActual closed 6 years ago

StaticActual commented 7 years ago

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 7 years ago

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.

brent-hoover commented 6 years ago

Issue moved to reactioncommerce/reaction-feature-requests #24 via ZenHub