canjs / can-view-scope

Scope management for view engines
https://canjs.com/doc/can-view-scope.html
MIT License
4 stars 0 forks source link

why getPathsForKey removed in production #171

Closed pYr0x closed 6 years ago

pYr0x commented 6 years ago

why is this function removed in production code? https://github.com/canjs/can-view-scope/blob/master/can-view-scope.js#L431

i got an error if i make a build.

i am not sure. but maybe this is related to https://github.com/donejs/autorender/commit/720af842ec204077a51be780df17bf4f5a2f63b4 i have a <x-login app:from="scope.vm"></x-login> and can tries to fetch vm with the function getPathsForKey. in production the functions is emtpy so i got this error.

steal.production.js:11 Potentially unhandled rejection [4] TypeError: Cannot read property 'vm' of undefined
    at Scope.hasKey (http://localhost:8080/dist/bundles/medicalpad/index.js:10858:30)
    at Object.hasKey (http://localhost:8080/dist/bundles/medicalpad/index.js:3694:31)
    at objHasKeyAtIndex (http://localhost:8080/dist/bundles/medicalpad/index.js:9855:89)
    at Object.read (http://localhost:8080/dist/bundles/medicalpad/index.js:9895:28)
    at Scope.read (http://localhost:8080/dist/bundles/medicalpad/index.js:10671:47)
    at ScopeKeyData.read (http://localhost:8080/dist/bundles/medicalpad/index.js:10525:39)
    at Observation.onBound (http://localhost:8080/dist/bundles/medicalpad/index.js:6756:40)
    at KeyTree.add (http://localhost:8080/dist/bundles/medicalpad/index.js:6399:40)
    at Observation.on (http://localhost:8080/dist/bundles/medicalpad/index.js:6568:27)
    at Object.eval [as onValue] (http://localhost:8080/dist/bundles/medicalpad/index.js:3122:31)

cc @phillipskevin

justinbmeyer commented 6 years ago

That function should only be used by dev logging.

Sent from my iPhone

On Jun 9, 2018, at 9:29 AM, Julian notifications@github.com wrote:

why is this function removed in production code? https://github.com/canjs/can-view-scope/blob/master/can-view-scope.js#L431

i got an error if i make a build.

i am not sure. but maybe this is related to donejs/autorender@720af84 i have a and can tries to fetch vm with the function getPathsForKey. in production the functions is emtpy so i got this error.

steal.production.js:11 Potentially unhandled rejection [4] TypeError: Cannot read property 'vm' of undefined at Scope.hasKey (http://localhost:8080/dist/bundles/medicalpad/index.js:10858:30) at Object.hasKey (http://localhost:8080/dist/bundles/medicalpad/index.js:3694:31) at objHasKeyAtIndex (http://localhost:8080/dist/bundles/medicalpad/index.js:9855:89) at Object.read (http://localhost:8080/dist/bundles/medicalpad/index.js:9895:28) at Scope.read (http://localhost:8080/dist/bundles/medicalpad/index.js:10671:47) at ScopeKeyData.read (http://localhost:8080/dist/bundles/medicalpad/index.js:10525:39) at Observation.onBound (http://localhost:8080/dist/bundles/medicalpad/index.js:6756:40) at KeyTree.add (http://localhost:8080/dist/bundles/medicalpad/index.js:6399:40) at Observation.on (http://localhost:8080/dist/bundles/medicalpad/index.js:6568:27) at Object.eval [as onValue] (http://localhost:8080/dist/bundles/medicalpad/index.js:3122:31) — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

pYr0x commented 6 years ago

yeah, but it gets called from https://github.com/canjs/can-view-scope/blob/master/can-view-scope.js#L539

justinbmeyer commented 6 years ago

Why does that get called? Can you create a test of a template that would call that?

pYr0x commented 6 years ago

here is a demo https://github.com/pYr0x/view-scope-bug