Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Make sure the user webhook is always at the top

Kiran Kbdc95d4ff258
diff --git a/apps/web/app/api/webhooks/route.ts b/apps/web/app/api/webhooks/route.ts
index c4f5a4d07a..cf984f1f68 100644
--- a/apps/web/app/api/webhooks/route.ts
+++ b/apps/web/app/api/webhooks/route.ts
@@ -26,13 +26,20 @@ export const GET = withWorkspace(
triggers: true,
disabledAt: true,
links: true,
+ receiver: true,
},
orderBy: {
updatedAt: "desc",
},
});
- return NextResponse.json(webhooks.map(transformWebhook));
+ // Make sure the user webhook is always at the top
+ const sortedWebhooks = webhooks.sort(
+ (a, b) =>
+ (b.receiver === "user" ? 1 : 0) - (a.receiver === "user" ? 1 : 0),
+ );
+
+ return NextResponse.json(sortedWebhooks.map(transformWebhook));
},
{
requiredPermissions: ["webhooks.read"],
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/page-client.tsx
index 20121bf986..219e0c249f 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/page-client.tsx
@@ -92,7 +92,7 @@ export default function WebhooksPageClient() {
) : (
<div className="grid grid-cols-1 gap-3">
{Array.from({ length: 3 }).map((_, idx) => (
- <WebhookPlaceholder />
+ <WebhookPlaceholder key={idx} />
))}
</div>
)}