Code Monkey home page Code Monkey logo

Comments (4)

coder543 avatar coder543 commented on April 28, 2024

Related, since the model only stores a single edit_value, you can cause another bug:

  1. create two todo items
  2. double click on one to begin editing
  3. double click on the other to begin editing
  4. type some text into the first item
  5. press enter in the second item

the text from the first item is transferred to the second item.

from yew.

coder543 avatar coder543 commented on April 28, 2024

Regarding the primary issue of this bug, adding

model.edit_value = model.entries[idx].description.clone();

to the Msg::ToggleEdit(idx) handler in update solves pressing enter immediately after entering edit mode, but it does nothing for the issue of editing multiple simultaneously.

from yew.

coder543 avatar coder543 commented on April 28, 2024

Personally, my thoughts lean towards the idea that having Model.edit_value be a String is fundamentally flawed, since the user could be editing more than one item at a time. I believe it makes more sense to preserve a list of items which are currently being edited, and then as the user types into a particular entry, it should update the actual Entry as each character is typed. The main reason not to go this route would be to have the option to undo if the user hit Esc.

To allow undoing, it could make sense to have a separate HashMap<usize, Entry> that contains a copy of each Entry presently being edited, keyed by the idx of the entries being edited. Changes would be reflected in real-time in the HashMap, and committed into the Vec.

The user could also be restricted to editing only one item at a time, I suppose.

from yew.

therustmonk avatar therustmonk commented on April 28, 2024

@coder543 Thank you found this bug )
This issue closed automatically, because I've merged fix of @machineloop.
You can reopen the issue if the problem not solved completely.

from yew.

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.