derbyjs / racer

Realtime model synchronization engine for Node.js
1.18k stars 116 forks source link

Copy query expression to guard against subsequent in-place edits to input expression #274

Closed mskeving closed 4 years ago

mskeving commented 4 years ago

Use deep copy of expression in Query constructor to prevent unintentional edits.

mskeving commented 4 years ago

@ericyhwang thanks. I went down that route originally, but thought the issue was coming earlier in the _getOrCreateQuery step of the query, preventing the query from being created in the first place. Turns out the way I had written my tests caused me to go down that path.

I updated tests for this scenario and tested locally and this does fix the issue 🎉

Still working on getting eslint to run to fix linting...

ericyhwang commented 4 years ago

Sorry, the command should be npx eslint --ignore-path .gitignore --fix . - npx runs a NPM binary installed under node_modules/.bin/

ericyhwang commented 4 years ago

Published to NPM as racer@0.9.11