Skip to content
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

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

lattei
Copy link

@lattei lattei commented Jul 21, 2023

No description provided.

Copy link

@anselrognlie anselrognlie left a 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.

Comment on lines +11 to +17
const newCard = {
id: Math.round(Math.random() * 10000000),
text,
board,
votesInteresting: 0,
};
setCards((cards) => [newCard, ...cards]);

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) => {

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) => {

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants