Git Product home page Git Product logo

Comments (5)

heapwolf avatar heapwolf commented on May 18, 2024

This is by design, but I'm not sure the developer experience is correct. Basically, id says, this is a significant component that should retain its state across re-renders. But, it's not intuitive, perhaps we should have an attribute that indicates this? maybe persistent=true?

from components.

Raynos avatar Raynos commented on May 18, 2024

Hmm, emphemereal=true might be a good option.

I think not persisting the state can lead to bad UX.

Is there a use case for not setting id on tonic-input ?

Cleaning the end users text upon reRender is a bad experience.

from components.

Raynos avatar Raynos commented on May 18, 2024

My suggested solution would be to add a check for props.id in the render method of tonic-input and throw an exception if it’s missing

from components.

heapwolf avatar heapwolf commented on May 18, 2024

Some inputs are optional, their values don't need to be remembered, but that might be the unimportant case. So we are saying we should just remember a component's state by default. I think that's pretty reasonable actually.

from components.

Raynos avatar Raynos commented on May 18, 2024

This is not possible to implement.

We can either :

  • do the current behavior of only persisting state for Tonic components that have an id field
  • Or add a new gaurd in the render() method of some components like tonic-input that make the id field mandatory and force developers to set it.

from components.

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.