Skip to content

Commit 6e8c7d3

Browse files
committed
fix: op badge
1 parent 231cd5d commit 6e8c7d3

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

components/post/CompactPost.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function CompactPost({
3737
className="hover:underline font-medium text-gray-800 dark:text-gray-600 truncate max-w-[100px]"
3838
title={post.author.displayName}
3939
>
40-
{`@${post.author.handle}`}
40+
{post.author.handle}
4141
</a>
4242
{op === post.author.handle && (
4343
<span className="ml-1 px-1.5 py-0.5 text-xs font-semibold bg-blue-100 text-blue-800 rounded-full dark:bg-blue-900 dark:text-blue-300">
@@ -65,7 +65,7 @@ export function CompactPost({
6565
)}
6666
</div>
6767
{isExpanded.value && (
68-
<PostReplies post={post} depth={depth + 1} isExpanded={isExpanded} />
68+
<PostReplies post={post} depth={depth + 1} isExpanded={isExpanded} op={op} />
6969
)}
7070
</article>
7171
);

components/post/FullPost.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function FullPost({ post }: FullPostProps) {
6161
<CompactPostActions post={post} />
6262
</div>
6363
</div>
64-
<PostReplies post={post} depth={0} isExpanded={isExpanded} />
64+
<PostReplies post={post} depth={0} isExpanded={isExpanded} op={post.author.handle} />
6565
</article>
6666
);
6767
}

components/post/PostReplies.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export function PostReplies({
1111
post,
1212
isExpanded,
1313
depth = 0,
14-
}: Omit<PostRepliesProps, 'prefetchedReplies'>) {
14+
op,
15+
}: PostRepliesProps) {
1516
const threadStateSignal = getThreadSignal(post.uri);
1617
const { data: replies, isLoading, error } = threadStateSignal.value;
1718

@@ -50,7 +51,7 @@ export function PostReplies({
5051
post={reply.post as AppBskyFeedDefs.PostView}
5152
depth={depth}
5253
expanded={isExpanded.value}
53-
op={post.author.handle}
54+
op={op}
5455
/>
5556
))
5657
)}

lib/signals.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,24 @@ export interface ThreadState {
1818
}
1919

2020
// Map where key is the root post URI, value is the signal for that thread's state
21-
export const threadsStore = signal(new Map<string, Signal<ThreadState>>());
21+
export const threadsStore = new Map<string, Signal<ThreadState>>();
2222

2323
// Helper function to get or initialize a thread signal
2424
export function getThreadSignal(uri: string): Signal<ThreadState> {
25-
const store = threadsStore.peek(); // Use peek to avoid subscribing components that just need the signal instance
26-
if (!store.has(uri)) {
25+
if (!threadsStore.has(uri)) {
2726
const newSignal = signal<ThreadState>({
2827
data: null,
2928
lastFetched: null,
3029
isLoading: false,
3130
error: null,
3231
});
33-
// Create a new map to trigger updates for components observing the map itself (if any)
34-
threadsStore.value = new Map(store.set(uri, newSignal));
32+
threadsStore.set(uri, newSignal);
3533
return newSignal;
3634
}
37-
return store.get(uri)!;
35+
return threadsStore.get(uri)!;
3836
}
3937

4038
// Signal to track which post's collapse controls (line/button) are hovered
4139
export const hoveredCollapsePostUri = signal<string | null>(null);
42-
43-
// -------------------------
44-
4540
// Signal to track the last version the user has seen the intro/update popup for
4641
export const lastSeenVersion = signalBrowserLocal<string>("last-seen-version", "0.0.0");

lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ export interface PostRepliesProps {
1212
depth?: number;
1313
maxDepth?: number;
1414
prefetchedReplies?: ThreadReply[];
15+
op?: string;
1516
}

0 commit comments

Comments
 (0)