Closed PeterMyer closed 1 year ago
Refresh on the home page returns created article
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.
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.
Hitting 500 status error from server when creating a new article.
All fields have input.