mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
add optimistic update for favorite/ratings mutations
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
TableColumnContainer,
|
||||
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
||||
import { ItemListItem } from '/@/renderer/components/item-list/types';
|
||||
import { useIsMutatingRating } from '/@/renderer/features/shared/mutations/set-rating-mutation';
|
||||
import { Rating } from '/@/shared/components/rating/rating';
|
||||
|
||||
export const RatingColumn = (props: ItemTableListInnerColumn) => {
|
||||
@@ -10,6 +11,8 @@ export const RatingColumn = (props: ItemTableListInnerColumn) => {
|
||||
props.columns[props.columnIndex].id
|
||||
];
|
||||
|
||||
const isMutatingRating = useIsMutatingRating();
|
||||
|
||||
if (typeof row === 'number' || row === null) {
|
||||
return (
|
||||
<TableColumnContainer {...props}>
|
||||
@@ -28,6 +31,7 @@ export const RatingColumn = (props: ItemTableListInnerColumn) => {
|
||||
rating,
|
||||
});
|
||||
}}
|
||||
readOnly={isMutatingRating}
|
||||
size="xs"
|
||||
value={row || 0}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user