Giter Club home page Giter Club logo

Comments (3)

brainkim avatar brainkim commented on June 7, 2024

this.hasRendered - easy to do yourself within the render loop

this.isRefreshing - a fun name for its pun potential but hard to determine for async trees. Is an enqueued update a refreshing update if it is the result of both a parent rendering and a refresh call? Should the last call determine this?

from crank.

brainkim avatar brainkim commented on June 7, 2024

I have been toying with the idea of computed properties which match the special props. There could even be special behaviors when reading/writing, if it makes sense. What would reading each computed property mean for each prop?

  • this.$key for $key

    • Readable?
      Readability case is great. Great for visually debugging key behavior, which is actually tricky. I often pass the key along as a data attribute data-key, I just want to get what the key is so I can do some sanity checks.
      Could even make the case for key chains (not sure what this means but it sounds interesting)
    • Writeable???
      Not really sure what over-writing a key would do. A component which re-assigns its key to a new value, would be the same as committing seppuku. The valid result might be instant unmounting (and remounting), but what is the use-case of that?
      One thing I have wanted is the ability for components to somehow “suggest” a key to the parent. I thought that make this API could be verbosely written as this.setOuterKey(key). The idea would be giving the component a suggested key when a $key is not explicitly passed.
      The implementation of outer keys or over-writable keys suffers from a chicken and egg problem, where a component can’t suggest a key without being called, but we don’t really know how to call the component without knowing if there’s already a keyed instance with the same key. API would have to be constrained somehow. Or maybe we need dark magic.
  • this.$ref for $ref

    • Readable?
      If refs are just callbacks, then reading this.$ref might imply the default behavior for refs and components is disabled. The idea is if you read the ref, you are responsible for calling it with the thing you need, probably passing the ref to a child.
    • Writable
      Probably no valid use-cases for a writeable this.$ref
  • this.$static for $static

    • Readable???
      this.$static would always be false if the component is rendering, so uhhhh not sure.
    • Writable?
      Could create some optional default static semantics to fully isolate a child rendering from a parent rendering. But a lot of the same problems as writable $key, it would be dark magic.

from crank.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.