kantlivelong / OctoPrint-GCodeSystemCommands

Define G-Code commands that execute local system commands.
GNU Affero General Public License v3.0
37 stars 20 forks source link

Fix settings variable in global scope js #21

Closed j7126 closed 2 years ago

j7126 commented 3 years ago

The settings variable in the command_definitions subscription callback in onBeforeBinding is being defined as a global variable and it probably should not be.

This PR makes it a local variable.

After testing the change, the plugin is working as before.

Some background as to why I found this I was looking into this issue (https://github.com/j7126/OctoPrint-Dashboard/issues/282), and a user reported that this issue is a conflict with OctoPrint-GCodeSystemCommands. After looking into the issue it seems that it was being caused by this global `settings` variable being referenced when the local `settings` variable on the dashboard side was undefined. I have fixed the issue on the dashboard side, however it is probably a good idea to fix this as well.
kantlivelong commented 2 years ago

Good catch. Thanks :+1: