These are chat archives for canjs/canjs

15th
Dec 2017
Jeroen Cornelissen
@jeroencornelissen
Dec 15 2017 12:33
@frank-dspeed @phillipskevin if can-element uses native Custom Elements then browsersupport isn’t good? Or is it polyfilled?
https://caniuse.com/#search=custom%20Elements
Viktor Busko
@Lighttree
Dec 15 2017 14:07
This is interesting topic. Am I right that its better to use can-element if you can ? Based on one of the latest videos (don't remember which exactly) there is idea that can-elementpreferred option.
Frank Lemanschik
@frank-dspeed
Dec 15 2017 14:08
@Lighttree @jeroencornelissen browser support is well yes it exists the google polyfill
can-element is the most best option for individual elements but its missing stuff like composing of components
while it would support composing of can-elements
you can also use a can-element to act as a can-component entry point
and from there on stache and can-view-callbacks
take over
so can-element is in terms of donejs only usefull to do the inital rendering
else it has not out of the box advantage
can-component registers a can-view-callback that renders the tag
can-element registers a element that renders it self
can-element at current offical state is not useable as real replacement for can-component
i created Elements with can-element that render can-components for example
or that are using can-define
but all that is custom work
can-element bare at present is only use able as base for a element its more a skeletton then anything else at current state because its missing the real Element replacements for the functionality that can-stache and that offers
Frank Lemanschik
@frank-dspeed
Dec 15 2017 14:13
for a example i created a can-route-element with a own router version
because can-route would not work as good in a can-element only scenario
as you will not have the ability to pass down vars so easy
Conclusion can-element will replace can-component done-component 100% no question there
but it needs a lot of coding to use its nativ methods
Chasen Le Hara
@chasenlehara
Dec 15 2017 17:55
@jeroencornelissen Yes, you do need to use a polyfill if you want to target anything other than Chrome or Safari.
@Lighttree We have some work to do before I would really recommend using can-element over can-component, although I think that is the eventual goal.
Looking through the issues, you can see that there’s a good chunk of work to be done: https://github.com/canjs/can-element/issues
Brad Momberger
@bmomberger-bitovi
Dec 15 2017 23:50
I need help with can-connect/real-time and a set algebra
Our algebra looks like this:
export default new set.Algebra(
  set.props.id('_id'),
  set.props.offsetLimit('$skip', '$limit'),
  set.props.sort('$sort', mongoSort),
  {
    address: function () {
      return true
    }
  }
}
mongoSort is a sorting function
When I try to query like this:
      const params = {
        $limit: this.limit,
        $skip: 0,
        type: this.type,
        $sort: 'price ' + (this.type === 'BUY' ? 'asc' : 'desc'),
        issuanceAddress: this.issuanceAddress
      }
I get the "One or more items were retrieved which do not match the 'Set' parameters used to load them." warning.
So can-connect/real-time gotListData() uses algebra.has() on the set (i.e. params) and each returned list item, and the list items don't have a $sort property.
And that seems to be failing this test here. Additionally, mongoSort() never fires. it seems to be using a default sort instead.
Anyone have any ideas why this would be warning and not working as intended? The net effect of this is when I add in the $sort parameter to the query, real-time stops working and newly created items don't get added to lists.