Repository navigation
Conversation
|
+1 |
|
@tomdale I believe you worked on the SortableMixin some. This seems good to me, but it wouldn't hurt to have some feedback from you. |
|
+1 so I can enable proper numeric sort |
|
@sly7-7 I think we need to add |
|
Now that I think about it, would it be more appropriate to just override |
|
@sly7-7 Thanks for the work, but I think the actual answer is to just override |
|
Well, let's see what I'm doing for now. As you can see, it's a stinking copy/paste of the orderBy function, the only difference stays in the naturalSort function... If you provide me a way to refactor this, I would be in favor of only closing this PR. Otherwise, I think it's really a pity to have to do this copy/paste programming, and wonder if there is a really an interrest of this mixin, rather than implementing a custom sort from the Array(Proxy) itself. |
|
Ok, I'll reopen for more feedback. |
|
Thanks Peter. If there no other feedback here during one day or two, it should mean this is not important, so I will definitively accept to close this :) |
|
maybe we should rename orderBy something different and make orderBy the simple inner method, that should be reimplemented in simple (most) cases. |
|
@tchak, I like the idea of making orderBy something simple that is intended to be overriden with something lower-level that you can override if you're doing something more complex. |
|
what about leaving orderBy as this, but only rename |
|
@sly7-7 Why don't you go ahead and make the change. Not that I'm a big fan of changing APIs but this would be an easy one to deprecate/alias if later we decided something else is more appropriate. |
|
@wagenet @sly7-7 I have one doubt. |
|
@tchak Ah, good point. Maybe we should just leave it as sortFunction. |
|
So, what about |
|
My choice would be |
|
I don't like the paradigm of making private functions overridable, but anyway, I won't "chipoter" here :) |
There was a problem hiding this comment.
Instead of doing a get(this, 'orderBy'), why not just call this.orderBy here? You'll have to make sure this is passed as the second argument to forEach.
There was a problem hiding this comment.
Thanks Peter, I update this. In fact I'm still quite a JavaScript beginner, so I programmed this through imitation.
There was a problem hiding this comment.
Well I'm glad you're diving right in despite being a beginner. Thanks for your hard work.
There was a problem hiding this comment.
This function, like Ember#compare, must return an integer
|
+1 for 'comperator' ... can you describe the final solution? how should a customized sort method be defined ? |
|
@ilanah You can see an example in the documentation here: https://github.com/sly7-7/ember.js/blob/54010d133252661a4ab6ffce258cca0146992c08/packages/ember-runtime/lib/mixins/sortable.js#L30 If it's not clear for you, just explain me why, and I will try to improve it. |
|
10xs, I will check it 2012/11/12 Sylvain MINA [email protected]
|
|
Close in favor of #1562 |
|
Since Arrangable was scrapped, could we re-open this? The docs are still valid, and the use-case for overriding the comparator (not the orderBy-method) is still valid since localeCompare is broken when doing string comparison for many languages (Swedish, German etc). |
[BREAKING] Update benchmark-env API
Add the `ember-component` deprecation for the default export of `@ember/component`. It is available in 7.5.0, not enabled, until 8.0.0. The deprecation fires on `Component.extend()` and in `init`. The `init` check covers native `class extends Component`. The rendering test harness renders each test template through a classic top-level component. It now uses `Component[INTERNAL_COMPONENT_EXTEND]`, which does not trigger the deprecation. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Add the `ember-component` deprecation for the default export of `@ember/component`. It is available in 7.5.0, not enabled, until 8.0.0. The deprecation fires on `Component.extend()` and in `init`. The `init` check covers native `class extends Component`. The rendering test harness renders each test template through a classic top-level component. It now uses `Component[INTERNAL_COMPONENT_EXTEND]`, which does not trigger the deprecation. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Add the `ember-component` deprecation for the default export of `@ember/component`. It is available in 7.5.0, not enabled, until 8.0.0. The deprecation fires on `Component.extend()` and in `init`. The `init` check covers native `class extends Component`. The rendering test harness renders each test template through a classic top-level component. It now uses `Component[INTERNAL_COMPONENT_EXTEND]`, which does not trigger the deprecation. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Add the `ember-component` deprecation for the default export of `@ember/component`. It is available in 7.5.0, not enabled, until 8.0.0. The deprecation fires on `Component.extend()` and in `init`. The `init` check covers native `class extends Component`. The rendering test harness renders each test template through a classic top-level component. It now uses `Component[INTERNAL_COMPONENT_EXTEND]`, which does not trigger the deprecation. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Add the `ember-component` deprecation for the default export of `@ember/component`. It is available in 7.5.0, not enabled, until 8.0.0. The deprecation fires on `Component.extend()` and in `init`. The `init` check covers native `class extends Component`. The rendering test harness renders each test template through a classic top-level component. It now uses `Component[INTERNAL_COMPONENT_EXTEND]`, which does not trigger the deprecation. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Add the `ember-component` deprecation, available in 7.6.0 and not enabled. It fires in `init`, once for each instance of the default export of `@ember/component`. Code cannot detect a native `class extends Component`, so `init` is the one place that sees every use. The test harness renders templates through a classic top-level component, also in the runs where the deprecation counts as removed. It sets the private `SKIP_DEPRECATION` key on its subclass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add the `ember-component` deprecation, available in 7.6.0 and not enabled. It fires in `init`, once for each instance of the default export of `@ember/component`. Code cannot detect a native `class extends Component`, so `init` is the one place that sees every use. The test harness renders templates through a classic top-level component, also in the runs where the deprecation counts as removed. A test helper switches the deprecation off while the harness creates that component, so production code has no exception for it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add the `ember-component` deprecation, available in 7.6.0 and not enabled. It fires in `init`, once for each instance of the default export of `@ember/component`. Code cannot detect a native `class extends Component`, so `init` is the one place that sees every use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add the `ember-component` deprecation, available in 7.6.0 and not enabled. It fires in `init`, once for each instance of the default export of `@ember/component`. Code cannot detect a native `class extends Component`, so `init` is the one place that sees every use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add the `ember-component` deprecation, available in 7.6.0 and not enabled. It fires in `init`, once for each instance of the default export of `@ember/component`. Code cannot detect a native `class extends Component`, so `init` is the one place that sees every use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add the `ember-component` deprecation, available in 7.6.0 and not enabled. It fires in `init`, once for each instance of the default export of `@ember/component`. Code cannot detect a native `class extends Component`, so `init` is the one place that sees every use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mber-component Implement RFC #1216: Deprecate the classic Component
GXT branches in shared tests (cache-counter parity, debug render tree,
resolver cache, helper registration through the runtime `hbs`), GXT skips
(hot reload, `{{mount}}`, classic `append`, the rehydration render mode, the
compile-options meta test), and renames that keep the names `array` and
`element` out of module scope in the single-chunk GXT test bundle.
New regression tests, which run on both backends, for the behaviours the
compat backend had wrong: has-block-params in nested blocks; the
(hash)/(array) identity tests (helpers/gxt-hash-array-identity-test.js,
because main rewrote array-test / hash-test as .gjs); attributes are not
arguments and URL attributes forwarded through `...attributes` are
sanitized, also on update (angle-bracket invocation, attribute bindings,
Input, LinkTo); a null/undefined/false attribute or class is removed and a
triple curly in an attribute renders its value (content-test); `<template>`
components invoked by name and classes with a class-body template
(template-tag-by-name-test.gjs, class-body-template-test.gjs,
template-tag-*-test.gjs); a `{{component}}` mustache passed as an argument
is curried; each `{{on}}` and each custom modifier on one element is its own
instance; renderComponent of a custom-managed plain-object definition, and a
root that updates in place, evaluates each binding once and throws only its
own errors. The named-outlets assertion test runs again (its method lacked
`@test`), with the column the compiler reports.
The rebase onto main keeps main's rewritten arranged-content tests, with the
`array` rename on top.
The per-fix history is on lifeart:gxt-pre-squash-b1bf210aef.
Adapted in the rebase onto main 493985e: contextual-components-test.js
is main's file plus this series' new test, and mount-test.js keeps the
GXT skip of the whole file around main's version; the runtime resolver
cache and template factory tests take main's expectations with GXT
branches (no root definition, one `-top-level` hit under the debug
render tree), and main's copies of the old tests in components/classic/
keep the GXT branches the old tests had; angle-bracket-invocation-test.js
imports `ClassicComponent` again for the two tests that use it.
Adapted in the rebase onto main 9ed2915 (RFC emberjs#1216, the classic
Component deprecation): append, attribute-bindings, runtime resolver
cache and template factory tests in components/classic/ take main's
deprecation-guarded files with this series' GXT branches re-applied
unchanged; the new button[formaction]/object[data] sanitization test
calls expectClassicComponentDeprecation() like main's other classic
component tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…r-component deprecation Main deprecates the classic Component (RFC emberjs#1216, emberjs#21630): Component#init calls deprecateUntil, so a test that creates a classic component fails in the "All deprecations enabled" job (unexpected deprecation) and throws in the "Deprecations as errors" jobs (the deprecation is removed at 8.0.0). Main guarded its own tests; four tests this series added were not: AngleBracket Invocation (URL sanitization of forwarded attributes): a bound URL attribute on a classic component element is sanitized, also on update AngleBracket Invocation (attributes are not arguments): a classic component does not see an attribute as a property Components test: argument names: a classic component gets an argument named SymbolTable a classic component invoked with curlies gets an argument named SymbolTable Each now expects the deprecation and is skipped once it is removed, with `${testUnless(DEPRECATIONS.DEPRECATE_EMBER_COMPONENT.isRemoved)} <name>`, the form the deprecations module documents. testUnless(false) is "@test", so the test names stay the same and native-skip.json and the baselines still match them. Co-Authored-By: Claude Opus 4.8 <[email protected]>
RFC #1216 deprecates the classic `Component` from `@ember/component`. API docs for APIs that are not deprecated still used it in examples. They now use `@glimmer/component` in gjs style, or drop the reference. - runInDebug, bind, next/scheduleOnce, RouterService#recognize: examples rewritten to Glimmer components. - Glimmer Component class docs: no more didInsertElement or this.element. - ApplicationInstance isBrowser: mention modifiers, not didInsertElement. - concatenatedProperties and extend: use Controller queryParams, remove the Component.extend example. - Textarea: remove the classic layout/layoutName section. - associateDestroyableChild and the yield Banner example: import Component from @glimmer/component. - @glimmer/component module intro: say classic components are deprecated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
GXT branches in shared tests (cache-counter parity, debug render tree,
resolver cache, helper registration through the runtime `hbs`), GXT skips
(hot reload, `{{mount}}`, classic `append`, the rehydration render mode, the
compile-options meta test), and renames that keep the names `array` and
`element` out of module scope in the single-chunk GXT test bundle.
New regression tests, which run on both backends, for the behaviours the
compat backend had wrong: has-block-params in nested blocks; the
(hash)/(array) identity tests (helpers/gxt-hash-array-identity-test.js,
because main rewrote array-test / hash-test as .gjs); attributes are not
arguments and URL attributes forwarded through `...attributes` are
sanitized, also on update (angle-bracket invocation, attribute bindings,
Input, LinkTo); a null/undefined/false attribute or class is removed and a
triple curly in an attribute renders its value (content-test); `<template>`
components invoked by name and classes with a class-body template
(template-tag-by-name-test.gjs, class-body-template-test.gjs,
template-tag-*-test.gjs); a `{{component}}` mustache passed as an argument
is curried; each `{{on}}` and each custom modifier on one element is its own
instance; renderComponent of a custom-managed plain-object definition, and a
root that updates in place, evaluates each binding once and throws only its
own errors. The named-outlets assertion test runs again (its method lacked
`@test`), with the column the compiler reports.
The rebase onto main keeps main's rewritten arranged-content tests, with the
`array` rename on top.
The per-fix history is on lifeart:gxt-pre-squash-b1bf210aef.
Adapted in the rebase onto main 493985e: contextual-components-test.js
is main's file plus this series' new test, and mount-test.js keeps the
GXT skip of the whole file around main's version; the runtime resolver
cache and template factory tests take main's expectations with GXT
branches (no root definition, one `-top-level` hit under the debug
render tree), and main's copies of the old tests in components/classic/
keep the GXT branches the old tests had; angle-bracket-invocation-test.js
imports `ClassicComponent` again for the two tests that use it.
Adapted in the rebase onto main 9ed2915 (RFC emberjs#1216, the classic
Component deprecation): append, attribute-bindings, runtime resolver
cache and template factory tests in components/classic/ take main's
deprecation-guarded files with this series' GXT branches re-applied
unchanged; the new button[formaction]/object[data] sanitization test
calls expectClassicComponentDeprecation() like main's other classic
component tests.
Folded in with the second squash: the tests of the fixes folded into the
compat backend and the native layer: a template's scope, keyword shadowing
and block params named like keywords, dotted paths, in-element
destinations, scope names, each-in forms, `{{#each}}` list paths, argument
names and built-in identity; the classic-dist guard's Node tests
(tests/node/dist-ast-test.cjs); nested and kept `{{#each-in}}` rows; rows
of a list keyed by position (what they yield and invoke, the components
they keep, type changes, each update hook once with the final arguments);
two-way bound arguments of each shape; functions passed to helpers; classic
component classes, curried or with only a layout, in a strict template's
scope. This series' classic component tests expect the ember-component
deprecation.
The history of these commits is on lifeart:gxt-pre-squash2-2063496034.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
The default sorting algorithm used in the Routable mixin (based on Ember.compare) was not satisfying in our case.
For example we want 'a' to appear before 'B' (in ascending order)
(new clean PR, I closed #1194