PeterMyer / BookIt

Web application and Chrome extension combination for collection, organization, and sharing of online articles
https://bookit-web-app.herokuapp.com/
MIT License
1 stars 0 forks source link

Create New Bookmark Bug #12

Closed PeterMyer closed 1 year ago

PeterMyer commented 2 years ago

Hitting 500 status error from server when creating a new article.

All fields have input.

PeterMyer commented 2 years ago

Refresh on the home page returns created article

PeterMyer commented 1 year ago

On creating a new article, the most recent article in state returns with empty values " " at the initial render of the home. This causes the .map function on tags to fail as there is nothing to map through.

PeterMyer commented 1 year ago

Resolved:

Error was due to looking up newly created article from DB with findByPk() prior to sequelize transaction commitment. Since commitment finalizes write to db look up fails to find new entry and returns blank value, which goes to state and causes error on render.

On refresh of page a new "get all user articles" call would be sent a retrieve all articles including new article.

Moved transaction commit above findByPk() call and issue resolved.