Giter VIP home page Giter VIP logo

grocere's People

Contributors

3ncastro avatar atulmi avatar dmncpham avatar dpham123 avatar francis-sjsu123 avatar isabelleshlow avatar markeymarke avatar vetag avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

grocere's Issues

Revising history.jsx

history={this.state.history}

This line passes our history array into the history component. But for some reason, the history component uses its own empty array as a state.

products: [],

This should be entirely omitted, as we should have a single source of truth, which is the history array in App.js that initializes upon loading the website. We don't need to populate the array anymore, as the users do it overtime in the DB or start with an empty array. As such, a few changes are needed such that history.jsx no longer uses this.state.products in any form.

OnAuthStateChanged not updating cart

https://github.com/MarkeyMarke/cmpe133-proj/blob/7fe73a5752662d308ab075881f8c2dbe0ba24293/src/App.js#L93

I'm opening up this issue so we can talk about it right here or on Discord. I have a few ideas to potentially get around this. According to this post: https://stackoverflow.com/questions/37873608/how-do-i-detect-if-a-user-is-already-logged-in-firebase it seems that using var user = firebase.auth().currentUser; from our getUID() function inside firebase.auth().onAuthStateChanged(...) may be a problem. This is because there are probably synchronization issues with doing this. What we could so is that outside of onAuthStateChanged we can just use getUID(), and then check if it's null or not. If it's not null, then we can proceed and set the cart accordingly.

If that doesn't work, then notice how onAuthStateChanged provides a user field in this line: https://github.com/MarkeyMarke/cmpe133-proj/blob/439105cda187089190bab733d62ed9db7ba2c698/src/App.js#L85 with that, perhaps instead of using getUID(), we can just get the user ID directly from that user reference as a property like user.uid, and then set the state using that uid instead.

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.