Query params @tracked

Thanks! I will add this to my If - Then - Else @tracked rule of thump.

@jenweber Maybe this should be in the Ember Guides too.

1 Like

Good call - you did remember correctly!

I clear QPs in my code (some are mutually exclusive) and this is the error I got when I removed @tracked from them. (I forgot I did track some QPs):

Error: Assertion Failed: You attempted to update <bnc@controller:application::ember224>.message to “”, but it is being tracked by a tracking context, such as a template, computed property, or observer. In order to make sure the context updates properly, you must invalidate the property when updating it. You can mark the property as @tracked, or use @ember/object#set to do this.

1 Like

Heads up for others reading this thread. There seems to be a performance issue when using @tracked on queryParams properties.

See this Github issue.

I ran into this performance issue and fixed it be removing @tracked only for the queryParam properties and then changing the queryParam properties with set()