fix(quotes): keep same-thread board previews local

This commit is contained in:
Tommaso Casaburi
2026-04-16 15:33:12 +07:00
parent f6ce2ba018
commit e366dac25c
16 changed files with 293 additions and 64 deletions
+3 -11
View File
@@ -6,11 +6,9 @@ import usePublishAuthorDomainGuard, { getPublishAuthorDomainErrorMessage } from
type UsePublishPostOptions = {
communityAddress?: string;
/** legacy compatibility */
subplebbitAddress?: string;
};
const usePublishPost = ({ communityAddress: requestedCommunityAddress, subplebbitAddress }: UsePublishPostOptions) => {
const usePublishPost = ({ communityAddress }: UsePublishPostOptions) => {
const { author, title, content, link, spoiler, publishCommentOptions } = usePublishPostStore((state) => ({
author: state.author,
title: state.title || undefined,
@@ -30,8 +28,6 @@ const usePublishPost = ({ communityAddress: requestedCommunityAddress, subplebbi
await abandonPublishRef.current?.();
}, []);
const communityAddress = requestedCommunityAddress ?? subplebbitAddress;
const createBaseOptions = useCallback(() => {
const baseOptions: Comment = {
communityAddress,
@@ -60,12 +56,8 @@ const usePublishPost = ({ communityAddress: requestedCommunityAddress, subplebbi
{} as Partial<Comment>,
);
const {
communityAddress: nextCommunityAddress,
subplebbitAddress: legacyCommunityAddress,
...restOptions
} = sanitizedOptions as Partial<Comment> & { subplebbitAddress?: string };
const resolvedCommunityAddress = nextCommunityAddress ?? legacyCommunityAddress ?? baseOptions.communityAddress;
const { communityAddress: nextCommunityAddress, ...restOptions } = sanitizedOptions;
const resolvedCommunityAddress = nextCommunityAddress ?? baseOptions.communityAddress;
const newOptions = {
...baseOptions,
...restOptions,