Skip to content
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

Fix function active/archived tab switching #1284

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ export function useRows({ archived }: { archived: boolean }): Output {

// Append new function data.
useEffect(() => {
if (functionsRes.data && functionsRes.data.page.page > functionsData.lastPage) {
if (!functionsRes.data || functionsRes.isLoading) {
return;
}

if (functionsRes.data.page.page > functionsData.lastPage) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this know to setFunctionsData on only archived vs. not archived?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data is cleared out when archived changes:
https://github.com/inngest/inngest/blob/main/ui/apps/dashboard/src/app/(organization-active)/(dashboard)/env/%5BenvironmentSlug%5D/functions/useRows.ts#L33

This whole hook needs to be refactored. It's probably the worst code I've written here

console.log('a2', functionsRes.data.functions.length);
goodoldneon marked this conversation as resolved.
Show resolved Hide resolved
setFunctionsData((prev) => {
return {
lastPage: functionsRes.data.page.page,
Expand Down