From 99b6aee18ec85c4f18ac36e502987304ed7e26ff Mon Sep 17 00:00:00 2001 From: devin ivy Date: Thu, 14 Mar 2024 09:57:24 -0400 Subject: [PATCH] Dedupe labels during appview hydration (#2317) * appview: reproduce duped labels * appview: dedupe labels in hydration * tidy types --- .../src/data-plane/server/routes/labels.ts | 32 +++++++++++---- packages/bsky/src/hydration/hydrator.ts | 13 +++--- packages/bsky/src/hydration/label.ts | 40 +++++++++++++++---- packages/bsky/src/hydration/util.ts | 8 +++- packages/bsky/src/views/index.ts | 14 +++---- packages/bsky/tests/label-hydration.test.ts | 13 ++++++ 6 files changed, 91 insertions(+), 29 deletions(-) diff --git a/packages/bsky/src/data-plane/server/routes/labels.ts b/packages/bsky/src/data-plane/server/routes/labels.ts index de5625d7784..a4dd2e6acac 100644 --- a/packages/bsky/src/data-plane/server/routes/labels.ts +++ b/packages/bsky/src/data-plane/server/routes/labels.ts @@ -3,28 +3,44 @@ import { noUndefinedVals } from '@atproto/common' import { ServiceImpl } from '@connectrpc/connect' import { Service } from '../../../proto/bsky_connect' import { Database } from '../db' +import { Selectable } from 'kysely' +import { Label } from '../db/tables/label' + +type LabelRow = Selectable