-
Notifications
You must be signed in to change notification settings - Fork 4
feat: show resources count and disable empty tabs #103
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
base: dev
Are you sure you want to change the base?
Conversation
|
@rknastenka is attempting to deploy a commit to the mrj3 Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| ); | ||
|
|
||
| // Fetch resource counts directly from the resource table | ||
| const { data: resourceCounts } = useLazyAsyncData( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rknastenka I noticed you opted not to use recordCount which actually fetches the count for current tab.
It's currently used to get pages number as you can see in this example. I suggest building on top of it instead of doing duplicate fetches for the count. Let me know if you need any help with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resourceCounts watches urlId (only re-fetches when course changes)
recordCount watches stateChangeDebounced (re-fetches on every tab/sort/search/page change)
If i used recordCount it would fetch ALL type counts on EVERY state change (tab switch, search, sort, pagination)
the total exam/note counts don't change when you search or sort.
That defeats the purpose of the optimization.
Let's say i made recordCount static (watching only urlId), i'll break pagination for any future search/filtering features because the counts won't update when filters change.
Let me know if you have any other suggestions on how to use only recordCount.
| }); | ||
| }); | ||
|
|
||
| onMounted(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was used to handle URLs with ?tab=note/?tab=exam to open the correct tab once page loaded/reloaded. Is there a reason why it was removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before I made this commit, there was a specific bug.
If you clicked on a course that has no exams, then tried to go to another course that has both exams and notes, it would go to the notes tab first, even though the exams tab was set as the default.
That only happens if you follow exactly the steps I mentioned.
Otherwise, it shows the exams tab first.
|
Last commit Closes #92 |
Closes #82
Note: Implemented as inline text rather than a badge for a cleaner, less cluttered UI.
Show the number of resources.

Disable and switch tabs
