Skip to content

Commit

Permalink
Bug Fix: Fix blank card issue on grade
Browse files Browse the repository at this point in the history
Refreshing the entire list on every grade caused card IDs to change a
few times while the card was navigating to the next index of the prev
list cause it to fall out of sync sometimes
  • Loading branch information
digitalmaster committed Dec 24, 2024
1 parent 77da721 commit 268100f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ const App = () => {
intervalMultiplier,
intervalMultiplierType,
});

refreshData();
} catch (error) {
console.error('Error Saving Practice Data', error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/overlay/PracticeOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const PracticeOverlay = ({
const isDueToday = dateUtils.daysBetween(nextDueDate, new Date()) === 0;
const status = isNew ? 'new' : isDueToday ? 'dueToday' : hasNextDueDate ? 'pastDue' : null;

const { data: blockInfo } = useBlockInfo({ refUid: currentCardRefUid });
const { blockInfo } = useBlockInfo({ refUid: currentCardRefUid });
const hasBlockChildren = !!blockInfo.children && !!blockInfo.children.length;
const [showAnswers, setShowAnswers] = React.useState(false);
const [hasCloze, setHasCloze] = React.useState(true);
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useBlockInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const useBlockInfo = ({ refUid }) => {
const fetch = async () => {
const blockInfo = await fetchBlockInfo(refUid);

setBlockInfo(blockInfo);
setBlockInfo({ ...blockInfo, refUid });
};

fetch();
}, [refUid]);

return {
data: blockInfo,
blockInfo,
};
};

Expand Down
2 changes: 2 additions & 0 deletions src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,8 @@ export interface BlockInfo {
string: string;
children: any[];
breadcrumbs: Breadcrumbs[];

refUid: string;
}
export interface Breadcrumbs {
[index: number]: { uid: string; title: string };
Expand Down

0 comments on commit 268100f

Please sign in to comment.