Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Julian Gonggrijp
    @jgonggrijp
    @ambicoder CDNs generally have a search function so you can look it up. Also, all versions of Underscore and Backbone are on jsDelivr and unpkg. Here's my search result on jsDelivr:
    https://www.jsdelivr.com/package/npm/backbone?version=1.1.2
    Dimitris
    @ambicoder
    yes...I know I should have searched my self....sorry for putting you in the trouble
    Julian Gonggrijp
    @jgonggrijp
    It's OK.
    Dimitris
    @ambicoder
    https://codepen.io/deoman12/pen/rNWPKdo?editors=0000 2 views per element..why that..take a close look...the one tooltip is on top of the other..this is what I am ttrying to achieve....https://codepen.io/deoman12/pen/xxRyePe?editors=0010 the latter is achieved without BBone.js
    Julian Gonggrijp
    @jgonggrijp
    @ambicoder I don't know where to see the tooltip, but both codepens you sent seem to be using Backbone (if that is what you meant by BBone.js). Also, I find it a bit suspicious that all code is inside the DOMContentLoaded event listener.
    Dimitris
    @ambicoder
    give me some minutes
    you are rigght they do not appear on initial calendar view...
    in week view click the next arrow button.. and go to week Mar 14 – 20, 2021...see the events now? orange color...ckick on them and you will see this ghost view https://codepen.io/deoman12/pen/rNWPKdo?editors=0011
    Dimitris
    @ambicoder
    lines 11-21
    eventDidmount function
    events clean monday and test
    more than one instance is created and I think this create the problem
    i think some cleanup/unbind must be done on init...not sure
    Dimitris
    @ambicoder
    I have tried numerous things...
    Julian Gonggrijp
    @jgonggrijp
    Ah I see what you mean. This is not a duplicate though, it's the tooltips of both events instead of only of the event you click on. I suppose that you might see three tooltips in a week that has three events.
    Julian Gonggrijp
    @jgonggrijp
    @ambicoder I don't know all these other APIs you're using, but I see that you're creating a single instance of tooltipview that you're reusing every time eventDidMount is called. You're creating a new tooltip with tippy (I think) every time when calling the render method of that single shared instance of tooltipview. I think that's how you're accumulating tooltips for all events in a single tooltipview.
    At the very least, you need a way to get rid of the tooltip that tippy creates after you're done with it.
    Dimitris
    @ambicoder
    any ideas how to deal with it?
    I have tried undelegate events..unbind..etc
    you are right about what you say though...
    Dimitris
    @ambicoder
    I have understood what the problem in theory is...but I do not know how to tackle the coding
    Dimitris
    @ambicoder
    Julian Gonggrijp
    @jgonggrijp
    @ambicoder Sorry I don't have time to look into it in more detail at this time. In any case though, don't just try things out. You need to really understand what's going on before you can fix anything. I suggest stepping through your code with a debugger, setting breakpoints and inspecting live variables until you fully understand why your bug is happening.
    Dimitris
    @ambicoder
    ok...in the process I will have to makse some questions...such as...when calling object render does that create a new instance such as new object()?
    Julian Gonggrijp
    @jgonggrijp
    @ambicoder aView.render() normally does not create a new object, but your tooltipview is calling tippy inside its render method. I suspect tippy is creating a new object (specifically, DOM elements) behind your back every time you call it.
    Dimitris
    @ambicoder
    is there a problem calling an object (on the render metho)inside a view?
    Julian Gonggrijp
    @jgonggrijp
    No that's fine in general. You do want to manage the resources that are created inside your view, though, so you can clean them up when you no longer need them.
    Dimitris
    @ambicoder
    ....can you say a little more on "clean when no longer needed"?
    Julian Gonggrijp
    @jgonggrijp
    Schermafbeelding 2021-03-16 om 20.13.10.png
    @ambicoder When you call tippy, it creates this tooltip widget. That's a div somewhere in the document with some classes and styling to position it relative to the event and to give it this particular look.
    This div should be removed again when you no longer need it. That's what I mean by "cleaning up".
    In an earlier version, you had the tooltips of two different events layered on top of each other. I think that happened because the tooltips were never removed.
    dimtabu
    @taburetkin
    @jgonggrijp hi!
    can you explain what exactly this line does ?
    attrs = _.defaults(_.extend({}, defaults, attrs), defaults);
    what the difference between just _.extend({}, defaults, attrs);
    i can see only one reason to doing that
    if attrs contains property with undefined value it will override the default one.
    and _.defaults() just replace undefined properties back to the defaults.
    correct me if there is something else
    Julian Gonggrijp
    @jgonggrijp
    @taburetkin Interesting question! Just to be clear, I'm not the original author... but let's take a look at createAssigner.
    dimtabu
    @taburetkin
    i am asking you because you are very familiar with underscore and this is actually underscore magic if you understand me )
    Julian Gonggrijp
    @jgonggrijp
    Yeah I understand. To be honest, I don't see how this expression could result in a different value than just _.defaults({}, attrs, defaults).
    But before we jump to conclusions, I suggest doing a git blame. There is probably some non-obvious reason why this is needed.
    Or maybe it was just somebody who didn't know what they were doing.
    dimtabu
    @taburetkin
    let attr = { foo: 'bar', baz: undefined };
    let defaults = { baz: 'boo' };
    let extendResult = _.extend({}, defaults, attr);
    // { foo: 'bar', baz: undefined }
    let defaultsResult = _.defaults(extendResult, defaults);
    // { foo: 'bar', baz: 'boo' }
    i thought that this was made for this case
    i mean i am thinking that for this. but i can be wrong or can miss something else
    Julian Gonggrijp
    @jgonggrijp
    @taburetkin So what is _.defaults({}, attr, defaults)?
    dimtabu
    @taburetkin
    defaults ignores properties if they have material values
    extend does not
    if i understood it correct
    Julian Gonggrijp
    @jgonggrijp
    @taburetkin Yes but notice the order.
    dimtabu
    @taburetkin
    _.extend({foo: 'bar' }, { foo: undefined}) => { foo: undefined}
    _defaults({foo: 'bar' }, { foo: undefined}) => {foo: 'bar' }
    so, i suppose that if you have default material value, say foo: 'bar' and you somehow provide initial attrs with own property foo without value ({foo: undefined}) the default value will not take effect after extend.
    and as i think thats why there is extend in first place and defaults in second, just to return default values for properties which was occasionly passed without values but has default values defined.
    i thought maybe there is something else )
    dimtabu
    @taburetkin
    also i suppose that this operation can be more faster if you have own extend method which can be setuped through options.
    something like extend(oneObject, secondObject, { ignoreUndefined: true, ignoreFunctions: true, ... })
    personaly in most cases i treat undefined as missed(not material) values and { property: undefined } is literally equal to {} at least for me
    Julian Gonggrijp
    @jgonggrijp

    @taburetkin I found jashkenas/backbone@92fb299 and this. The change was motivated by an exotic edge case. I'm not convinced that it was a good change, since that first PR also removes a perfectly valid test for a much more common scenario. It is basically increasing code complexity in order to support overriding non-enumerable Object.prototype properties.

    For undefined you don't need, it _.defaults by itself will already do the same job:

    a = {foo: 'bar'}
    // {foo: "bar"}
    b = {foo: undefined}
    // {foo: undefined}
    _.extend({}, a, b)
    // {foo: undefined}
    _.extend({}, b, a)
    // {foo: "bar"}
    _.defaults({}, a, b)
    // {foo: "bar"}
    _.defaults({}, b, a)
    // {foo: "bar"}
    _.defaults(_.extend({}, a, b), a)
    // {foo: "bar"}
    _.defaults(_.extend({}, b, a), b)
    // {foo: "bar"}
    dimtabu
    @taburetkin
    @jgonggrijp yeah, thanks. my eng is not good enough. as i can see from discussion my suppose was correct
    thank you for your attention )