-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kunzite - In Your F[abiola], A[nn], C[arline], E[rina] #14
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small bit of light feedback. I noticed that some of your card operations aren't going all the way to the backend (and hence the database). Adding, deleting, and liking cards should be tracked by the backend, but currently there aren;t any API calls being made for those operations.
const newCard = { | ||
id: Math.round(Math.random() * 10000000), | ||
text, | ||
board, | ||
votesInteresting: 0, | ||
}; | ||
setCards((cards) => [newCard, ...cards]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀 This isn't adding a new card to the database. This will only affect the local state, and any cards added will be lost when the page reloads.
Rather than passing in setCards
from App
, we should pass in a function that the form can use to notify App
that there is new card data available. App
would use that data to both create the new card on the backend, as well as adding the newly created card to the frontend state. The backend would be responsible for assigning an id to the new card (or rather, the database will when the backend adds the card data to the database).
setShowConfirmation(true); | ||
}; | ||
|
||
const handleDeleteConfirmation = (confirmed) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀 This is only removing a card from the local cards state. This doesn't affect any cards in the database.
setShowConfirmation(false); | ||
}; | ||
|
||
const handleIncrementLikes = (cardId, category) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀 This is only increments the like count in the local cards state. This doesn't affect any cards in the database.
Consider adding a custom route to the backend for liking a card that only needs the liked card id. Then the UI wouldn't need to know about any of the logic required to like a card. It could call the like endpoint, get the updated card data, and use that to update the local card state.
No description provided.