> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/sample-flows.md

## Article Content:

# Votes: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It provides a useful starting point as you plan your implementation.

## Show and change a comment vote

A comments interface can let a visitor or member express an opinion and change it later. Keep the same authenticated identity throughout this flow.

> Prerequisite: Use a comment in a context that allows the caller to vote. The app ID and context ID must match that comment's integration.

To cast, change, and remove a vote:

1. Take the comment ID from the displayed comment and prepare its `contextData`.
2. Call [Upvote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/upvote.md) with the comment ID as `resourceId`, `wix.comments.v2.comment` as `resourceFqdn`, and that `contextData`.
3. Save the returned `vote.voteId` and display the selection from `vote.type`.
4. Call [Downvote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/downvote.md) with the same resource and context to change the vote. Refresh the displayed selection from the response.
5. Call [Remove Vote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/remove-vote.md) with the returned `vote.voteId` and the same context to clear the selection.

## Restore vote controls after a page reload

When comments load, retrieve the current visitor's or member's votes to restore the voting controls. An application query can return other identities' votes and isn't a substitute for this personal query.

To restore the selections:

1. Collect the displayed comment IDs that share the same app and context.
2. Call [Query Votes](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/query-votes.md) with the visitor's or member's authentication, that `contextData`, and a `query.filter` such as:

   ```json
   {
     "resourceId": {
       "$in": ["90616636-cfe2-4f3d-88ce-1c3d8e3eaa67", "658c953a-b71b-48bc-8f76-49d9aecf9605"]
     }
   }
   ```

3. Retrieve the remaining pages using `paging.cursors.next` as `query.cursorPaging.cursor`, keeping the filter and context unchanged.
4. Index the returned votes by `resourceId` and render each selection from `type`. After all pages are loaded, comments without a matching vote have no selection.
5. Keep each `voteId` for later removal. Clear and reload personal vote state when the identity changes.