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: Redirect to quest dashboard using router.push and remove handlePagination #1022

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app/admin/quests/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,16 @@ export default function Page() {
setButtonLoading(true);
const id = await handleCreateQuest();
if (!id) return;

await handleCreateBoost(id);
await handleCreateNftUri(id);
await setButtonLoading(false);
handlePagination("Next");
}, [questInput, boostInput, nfturi]);

Comment on lines +250 to +253
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add error handling for async operations

The async operations lack proper error handling. If any operation fails, the loading state remains active and the user receives no feedback.

Consider wrapping the operations in a try-catch block:

-    await handleCreateBoost(id);
-    await handleCreateNftUri(id);
+    try {
+      await handleCreateBoost(id);
+      await handleCreateNftUri(id);
+    } catch (error) {
+      setButtonLoading(false);
+      showNotification("Failed to create quest components", "error");
+      console.error("Error creating quest components:", error);
+      return;
+    }

Committable suggestion skipped: line range outside the PR's diff.

setButtonLoading(false);

// Redirect to the quest dashboard using the quest ID
router.push(`/admin/quests/dashboard/${id}?tab=tasks`);
}, [questInput, boostInput, nfturi, router]);


const handleCreateTask = useCallback(async () => {
if (isSaving.current) return;
Expand Down
Loading