emberjs / ember.js

Ember.js - A JavaScript framework for creating ambitious web applications
https://emberjs.com
MIT License
22.45k stars 4.21k forks source link

Deprecation "setting-on-hash" #19975

Closed Timbuktu1982 closed 1 year ago

Timbuktu1982 commented 2 years ago

Hi there,

since i using ember 4 i get the deprecation message with id "setting-on-hash". I cannot find this deprecation in any deprecation documentation.

Where i can find it?

THX

bertdeblock commented 2 years ago

👋 I don't think there's any documentation around that deprecation atm.

It's also coming from the VM: https://github.com/glimmerjs/glimmer-vm/blob/9c44e6835d27fcc7dc0e276cf3b0ee011d1ffb90/packages/%40glimmer/runtime/lib/helpers/hash.ts#L15-L21

It basically says to not set or modify any properties directly on the object that is returned by the {{hash}} helper.

I created https://github.com/ember-learn/deprecation-app/issues/1085 as a reminder to document that deprecation.

Timbuktu1982 commented 2 years ago

Yeah, i think i have adjust all usages of hash-helper, but i still become the message. And the message contains no information about the template, that causes this deprecation.

bertdeblock commented 2 years ago

It could be that the deprecation is triggered by addon code. Normally the stack trace should indicate the offending code.

Timbuktu1982 commented 2 years ago

I think so too. But the message is to short to get the needed information...

Here an example:

DEPRECATION: You set the 'targetRoute' property on a {{hash}} object. Setting properties on objects generated by {{hash}} is deprecated. Please update to use an object created with a tracked property or getter, or with a custom helper. [deprecation id: setting-on-hash] registerHandler/HANDLERS[type]@http://127.0.0.1:4200/assets/vendor.js:49935:17 raiseOnDeprecation@http://127.0.0.1:4200/assets/vendor.js:49857:13 registerHandler/HANDLERS[type]@http://127.0.0.1:4200/assets/vendor.js:49935:17 _registerTime4InnovationDeprecationHandler/<@http://127.0.0.1:4200/assets/wirth-beton.js:6627:20 registerHandler/HANDLERS[type]@http://127.0.0.1:4200/assets/vendor.js:49935:17 invoke@http://127.0.0.1:4200/assets/vendor.js:49947:23 deprecate@http://127.0.0.1:4200/assets/vendor.js:49903:28 deprecate@http://127.0.0.1:4200/assets/vendor.js:25388:61 set@http://127.0.0.1:4200/assets/vendor.js:68900:61 _loop$@http://127.0.0.1:4200/assets/vendor.js:250294:110 tryCatch@http://127.0.0.1:4200/assets/vendor.js:6821:40 invoke@http://127.0.0.1:4200/assets/vendor.js:7050:30 defineIteratorMethods/</prototype[method]@http://127.0.0.1:4200/assets/vendor.js:6873:21 tryCatch@http://127.0.0.1:4200/assets/vendor.js:6821:40 maybeInvokeDelegate@http://127.0.0.1:4200/assets/vendor.js:7113:26 invoke@http://127.0.0.1:4200/assets/vendor.js:7024:51 defineIteratorMethods/</prototype[method]@http://127.0.0.1:4200/assets/vendor.js:6873:21 step@http://127.0.0.1:4200/assets/vendor.js:114273:63 generatorStep@http://127.0.0.1:4200/assets/vendor.js:116129:46 handleResolvedContinueValue@http://127.0.0.1:4200/assets/vendor.js:115981:31 proceedSync@http://127.0.0.1:4200/assets/vendor.js:115943:16 proceedAsync/<@http://127.0.0.1:4200/assets/vendor.js:115928:24 invoke@http://127.0.0.1:4200/assets/vendor.js:72244:16 flush@http://127.0.0.1:4200/assets/vendor.js:72136:19 flush@http://127.0.0.1:4200/assets/vendor.js:72343:21 _end@http://127.0.0.1:4200/assets/vendor.js:72915:34 Backburner/this._boundAutorunEnd@http://127.0.0.1:4200/assets/vendor.js:72555:15 promise callback*buildNext/<@http://127.0.0.1:4200/assets/vendor.js:71919:31 flush@http://127.0.0.1:4200/assets/vendor.js:54300:5 _scheduleAutorun@http://127.0.0.1:4200/assets/vendor.js:73134:14 _end@http://127.0.0.1:4200/assets/vendor.js:72925:18 Backburner/this._boundAutorunEnd@http://127.0.0.1:4200/assets/vendor.js:72555:15 promise callback*buildNext/<@http://127.0.0.1:4200/assets/vendor.js:71919:31 flush@http://127.0.0.1:4200/assets/vendor.js:54300:5 _scheduleAutorun@http://127.0.0.1:4200/assets/vendor.js:73134:14 _end@http://127.0.0.1:4200/assets/vendor.js:72925:18 Backburner/this._boundAutorunEnd@http://127.0.0.1:4200/assets/vendor.js:72555:15 promise callback*buildNext/<@http://127.0.0.1:4200/assets/vendor.js:71919:31 flush@http://127.0.0.1:4200/assets/vendor.js:54300:5 _scheduleAutorun@http://127.0.0.1:4200/assets/vendor.js:73134:14 _ensureInstance@http://127.0.0.1:4200/assets/vendor.js:73122:14 schedule@http://127.0.0.1:4200/assets/vendor.js:72691:19 @http://127.0.0.1:4200/assets/vendor.js:74039:28 fulfill@http://127.0.0.1:4200/assets/vendor.js:79295:14 resolve$1@http://127.0.0.1:4200/assets/vendor.js:79270:14 initializePromise/<@http://127.0.0.1:4200/assets/vendor.js:79393:18 fileReaderReady/</reader.onload@http://127.0.0.1:4200/assets/vendor.js:81892:20 EventHandlerNonNull*fileReaderReady/<@http://127.0.0.1:4200/assets/vendor.js:81891:11 initializePromise@http://127.0.0.1:4200/assets/vendor.js:79387:15 Promise@http://127.0.0.1:4200/assets/vendor.js:79905:35 fileReaderReady@http://127.0.0.1:4200/assets/vendor.js:81890:16 readBlobAsText@http://127.0.0.1:4200/assets/vendor.js:81910:38 Body/this.text@http://127.0.0.1:4200/assets/vendor.js:82030:20 determineBodyPromise@http://127.0.0.1:4200/assets/vendor.js:82500:38 _callee$@http://127.0.0.1:4200/assets/vendor.js:85366:56 tryCatch@http://127.0.0.1:4200/assets/vendor.js:6821:40 invoke@http://127.0.0.1:4200/assets/vendor.js:7050:30 defineIteratorMethods/</prototype[method]@http://127.0.0.1:4200/assets/vendor.js:6873:21 asyncGeneratorStep@http://127.0.0.1:4200/assets/vendor.js:84463:105 _next@http://127.0.0.1:4200/assets/vendor.js:84465:214 promise callback*asyncGeneratorStep@http://127.0.0.1:4200/assets/vendor.js:84463:244 _next@http://127.0.0.1:4200/assets/vendor.js:84465:214 _asyncToGenerator/</<@http://127.0.0.1:4200/assets/vendor.js:84465:371 _asyncToGenerator/<@http://127.0.0.1:4200/assets/vendor.js:84465:99 ajax@http://127.0.0.1:4200/assets/vendor.js:85409:23 query@http://127.0.0.1:4200/assets/vendor.js:84922:19 query@http://127.0.0.1:4200/assets/vendor.js:254520:132

bertdeblock commented 2 years ago

You could try searching for targetRoute in your vendor.js file to see where it's used/set and look at the surrounding code to determine from which package it originates?

Timbuktu1982 commented 2 years ago

Ah ok, I had searched for the parameters in all our addons but had not found them. The idea to look in the build I have not yet come. Thanks for the tip

maxwondercorn commented 2 years ago

@Timbuktu1982 it might be in an addon being used by one of your addons. When I’m trying to figure out where something is being used I will use Ember Observer’s code search

bertdeblock commented 1 year ago

I think we can close this. The deprecation is documented here: https://deprecations.emberjs.com/v3.x#toc_setting-on-hash.