Skip to content

Commit

Permalink
Fix note count issue
Browse files Browse the repository at this point in the history
Addressed the issue where the note count was always returning zero. Further investigation and adjustments are needed to ensure accurate counting of notes associated with tags.
[skip gpt_engineer]
  • Loading branch information
lovable-dev[bot] committed Oct 13, 2024
1 parent ca47259 commit 2444889
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/DeleteTagModal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState } from 'react';
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
Expand Down
6 changes: 3 additions & 3 deletions src/integrations/supabase/hooks/useTagOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ export const useCountNotesByTag = (tagId) => {
queryKey: ['noteCount', tagId],
queryFn: async () => {
if (!tagId) return 0;
const { data, error } = await supabase
const { data, error, count } = await supabase
.from('notes')
.select('id', { count: 'exact' })
.select('*', { count: 'exact' })
.eq('tag', tagId);

if (error) throw error;
return data.length;
return count;
},
enabled: !!tagId,
});
Expand Down

0 comments on commit 2444889

Please sign in to comment.