routes object in compiled alchemy/admin.js does not include node namespace - alchemy_cms

Steps to reproduce

For me, when I open /admin/nodes in the browser and try move or fold a node I get this error: Alchemy.routes.move_api_node_path is not a function

Expected behavior

The compiled admin.js file should include the node namespace in Alchemy.routes (it should reflect the latest code) to not throw an error.

System configuration

  • Alchemy Version: main branch
  • Rails Version: 6

I pulled the latest Alchemy changes from main branch (including the recent node namespacing in Alchemy.routes) and ran rake webpacker:clobber in my host app to ensure a blank slate. Maybe I am just missing something stupidly simple, but I don't see why I am still getting old js code compiled into the admin.js file.

This is an excerpt from my freshly compiled admin.js

function onFinishDragging(evt) {
  var url = Alchemy.routes.move_api_node_path(evt.item.dataset.id);
  ...
}

...

function handleNodeFolders() {
   ...
    var url = Alchemy.routes.toggle_folded_api_node_path(nodeId);
}

Those two examples should now actually look like * Alchemy.routes[evt.item.dataset.type].move_api_path(evt.item.dataset.id) * Alchemy.routes[this.dataset.recordType].toggle_folded_api_path(nodeId)

Asked Sep 25 '21 22:09
avatar robinboening
robinboening

2 Answer:

This is a new feature only merged into main that is not released on NPM yet. You can fix this by pointing the @alchemy_cms/admin package in your package.json to GitHub:

{
  "dependencies": {
    "@alchemy_cms/admin": "git://github.com/AlchemyCMS/alchemy_cms.git"
  }
}
1
Answered Apr 19 '21 at 12:32
avatar  of tvdeyen
tvdeyen

@tvdeyen I tried pointing it to Github, but without success. Even if I intentionally misspell the Github URL webpacker is still able to compile the admin.js from somewhere. It seems to ignore the information in package.json.

1
Answered Apr 19 '21 at 13:39
avatar  of robinboening
robinboening