Coder Social home page Coder Social logo

Comments (5)

vinnymac avatar vinnymac commented on August 16, 2024 1

I say let's try to get everything out the door for Release v1.1.0 and then maybe we can do a better job with all of this. If we can patch/hug this issue for now, I will be happy with it. I would be glad to do a react milestone after this, and the codebase will become a lot more flexible at that point.

from pokenurse.

vinnymac avatar vinnymac commented on August 16, 2024

It looks to me like we are telling the server to change the favorite status and updating the UI without updating the state. Which is the wrong way to the think about it in my opinion.

Ideally we should be managing the local state and the UI should be responding to those changes.
Storing the state in local storage is fine (we could even write to disk using the fs module). Although that would fix the issue, it would require us to re-render the entire list.

  1. User clicks Favorite UI which is in state false
  2. Update local Favorite State to true and Render Favorite UI change
  3. Send Request
    • Success
      • Update local Favorite State true and Render Favorite UI change
    • Error
      • Update local Favorite State false and Render Favorite UI change

In this scenario our state is our pokemon monsters object. If we switched to React this scenario would be a lot simpler for me to wrap my head around. Let me think on it some more. Do you agree with my thoughts above? Do you see an error in the logic?

from pokenurse.

mackhankins avatar mackhankins commented on August 16, 2024

You're on the money. I just haven't written a lot of JS period so it's all new to me.. I'm onboard with React, but you're obviously going to have to get us started down that road.

Prioritize bugs and not take on new features if we're going to go towards React.

from pokenurse.

vinnymac avatar vinnymac commented on August 16, 2024

@mackhankins I tested my fix, and am curious what you think of it. Since you reproduced the issue, I'd like confirmation that it actually fixes it :P

from pokenurse.

mackhankins avatar mackhankins commented on August 16, 2024

Good job. Tested and working.

from pokenurse.

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.