question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

avoid-leaking-state-in-ember-objects flags computed.sort definition

See original GitHub issue

If you use the sort computed property, it gets flagged as leaking state. Example:

sortedTimeslotBlocks: computed.sort('timeslotBlocks', 'timeslotBlocksSorting'),
timeslotBlocksSorting: ['startsAt:asc'],

I can see why this was flagged, but it seems weird to flag this since the docs use this syntax: https://emberjs.com/api/ember/2.15/namespaces/Ember.computed/methods/sort?anchor=sort

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:7
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rwjbluecommented, Jan 9, 2018

Yes, however classNames, classNameBindings, and attributeBindings are very common and as such they are whitelisted in this rule (see here).

0reactions
xtagoncommented, Jan 9, 2018

There are a lot of different ways to solve it with different syntax. Is there merit to one over the other? For example, is Object.freeze recommended over using constants or init?

Read more comments on GitHub >

github_iconTop Results From Across the Web

sort - 4.9 - Ember API Documentation
A computed property which returns a new array with all the properties from the first dependent array sorted based on a property or...
Read more >
Flags no longer sort by definition order · Issue #1420 · urfave/cli
Flags used to be shown in help text output in the same order in which they are defined in code, but they now...
Read more >
Sort Your Data 유닛 - Trailhead - Salesforce
A computed sort organizes the data in the view by applying rules, such as sorting alphabetically or sorting quantities in descending order. Computed...
Read more >
How is Sorting achieved in an Ember model without using ...
In Ember 2.0 SortableMixin is deprecated and is on its way out too. In the Controller (not the ArrayController ) you may define...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found