Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Nick Dodson
    @SilentCicero
    could also be that multiple components are bonded to the one element, and so they fire the hooks far more
    which would make sense
    anyway, something to think abut
    Nick Dodson
    @SilentCicero
    for (;(vnode.$ || renderChildren).call;)                                // (This expands to : vnode.$ && vnode.$.call &&)
                                                                          // If the vnode is a functional component, expand
              (k => vnode = vnode.$(                                            // it and replace the current vnode variable.
    
                vnode.a,                                                  // 1. The component properties
                (_state[k] = _state[k] || {}) && _state[k],               // 2. The stateful component state
    
                newState =>                                               // 3. The setState function
                  ObjectAssign(                                           // First we update the state record, that also updates
                    _state[k],                                               // the contents of the DOM element, since the reference
                    newState                                              // is perserved.
                  ) &&
                  render(                                                 // We then trigger the same render cycle that will
                    vnodes,                                               // update the DOM
                    dom
                  ),
    
                 _hooks                                                    // 4. The lifecycle method hooks
    
              ))(index++);
    it seems to cause a problem during re-render, where others merged on the same state are not reset
    so when setState is fire, it cant just be for this node, it has to reset the state of the other components below it
    Nick Dodson
    @SilentCicero
    this will work, it resets the other state:
    for (;(vnode.$ || renderChildren).call;)                                // (This expands to : vnode.$ && vnode.$.call &&)
                                                                          // If the vnode is a functional component, expand
              (k => vnode = vnode.$(                                            // it and replace the current vnode variable.
    
                vnode.a,                                                  // 1. The component properties
                _state[k] || {},                                          // 2. The stateful component state
    
                newState =>
                  _state.fill({}, 0, k) &&                                  // 3. The setState function
                  ObjectAssign(                                           // First we update the state record, that also updates
                    (_state[k] = _state[k] || {}) && _state[k],                                               // the contents of the DOM element, since the reference
                    newState                                              // is perserved.
                  ) &&
                  render(                                                 // We then trigger the same render cycle that will
                    vnodes,                                               // update the DOM
                    dom
                  ),
    
                 _hooks                                                    // 4. The lifecycle method hooks
    
              ))(j++);
    I was actually thinking, if we use a similar design for the entire state model, we can just fill an array downward with empty state, thus resetting state on re-render
    thats if the entire state was an array 0 -- x
    or just splice it out and allow reset
    each node would be given a number in the state memory (a nonce)
    Nick Dodson
    @SilentCicero
    ha! that fixed my other problem.. yay
    
    Feature    Chrome    Firefox (Gecko)    Edge    Internet Explorer    Opera    Safari
    Basic support    45 [1]    31 (31)    (Yes)    No support    No support    7.1
    no IE support though
    Ioannis Charalampidis
    @wavesoft
    Wow man, you have done some serious thinking here :D
    Do you think you can make a proper pull request to discuss over there? It's kind of hard to track the diffs as a comment :D
    Seems that you found some interesting solution there
    So what's limiting the support? The .fill ?
    What about Array(k) ?
    hmm.. not repeating the {}
    Nick Dodson
    @SilentCicero
    So the fill was for doing state. Although there seemed to be problems with this approach
    Didn't have time to figure it out
    Yes, I can do a PR to discuss
    just thinking out loud
    Nick Dodson
    @SilentCicero
    @wavesoft I've been thinking about a way to solve double higher order components
    by calling the render function if the higher order component function returns a function
    so the element == render result (that way it is recursive)
    but I also think we should not bond anything to the dom
    just compare old dom element to new, but dont store props or state on the dom at all
    that way we can have infinite amounts of higher order components without touching the dom
    I think it's the right way to do this
    to have a real vdom comparible to the big boys for IOT
    brettg2
    @brettg2
    @wavesoft hello. I came across dot-dom after searching for a smaller virtual dom implementation but was frustrated that root vnodes are re-rendered when state changes on sub-components. I was able to find a way around this but I'm seeing issues with mock-browser returning blank strings for innerHTML while running tests, yet running the same tests from actual browser look fine.
    Ioannis Charalampidis
    @wavesoft
    Helly @brettg2 . This looks like an issue with mock-browser. If you can put some trace messages on your changes and confirm that they are called, then it's definitely mock-browser's fault
    brettg2
    @brettg2
    @wavesoft check out this modification, it adds a cache for node referencing. Here is a before and after fiddle. It has a larger footprint than 512 bytes and doesn't pass tests because of mock-browser's issues so maybe this other version should stay as a separate repo? Let me know what you think. Also, it's been a huge relief to find something this small that can do essentially the same thing as what behemoths like React and Angular are doing. Your work here is greatly appreciated. Thank you.
    Ioannis Charalampidis
    @wavesoft
    Thanks for your kind words @brettg2 ! Glad to see this is being helpful :smile: My "512 byte" limit was partially a challenge and partially a requirement when trying to create an interactive UI that fits in an average Arduino flash chip size.
    I had this discussion with other guys regarding features "extending the 512 byte limit", and therefore I thought of introducing a build-on-demand system where you can pick which extensions to include in the bundle.
    Can you (1) Create a branch in your fork with your changes and (2) Create PR with your message above in order for me not to forget?
    brettg2
    @brettg2
    @wavesoft no problem. I am still working on a way to improve access to globalState. Using strings for keys and selecting on each render slows down redraws so I'm building a linked list kind of thing to improve referencing correct nodes. I'll keep you posted
    Ioannis Charalampidis
    @wavesoft
    Have a look to the devel/0.3.0 branch too.
    I also started working on state on ic/smarter-state-perservation
    on 0.3.0 I introduced lifecycle methods, towards proper high-order components.
    brettg2
    @brettg2
    @wavesoft I created a new fork and branch from master @ https://github.com/brettg2/dot-dom/tree/brettg2/cache but the pull request hangs on jest. I'm not sure what to do next.
    brettg2
    @brettg2

    It's getting this error message: No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
    Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received

    The build has been terminated

    Ioannis Charalampidis
    @wavesoft
    Hey @brettg2 ! Thanks for the PR, I will have a look over the weekend because this week is a bit tight work-wise :worried:
    I can't think of anything from the top of my head that would hang the build
    Ioannis Charalampidis
    @wavesoft
    Just writing to let everyone know that I am still monitoring this channel once in a while :D