mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(hooks): handle pkc rebrand regressions
This commit is contained in:
@@ -32,7 +32,6 @@ const usePublishPost = ({ communityAddress: requestedCommunityAddress, subplebbi
|
||||
const createBaseOptions = useCallback(() => {
|
||||
const baseOptions: Comment = {
|
||||
communityAddress,
|
||||
subplebbitAddress: communityAddress,
|
||||
title,
|
||||
content,
|
||||
link,
|
||||
@@ -58,7 +57,17 @@ const usePublishPost = ({ communityAddress: requestedCommunityAddress, subplebbi
|
||||
{} as Partial<Comment>,
|
||||
);
|
||||
|
||||
const newOptions = { ...baseOptions, ...sanitizedOptions };
|
||||
const {
|
||||
communityAddress: nextCommunityAddress,
|
||||
subplebbitAddress: legacyCommunityAddress,
|
||||
...restOptions
|
||||
} = sanitizedOptions as Partial<Comment> & { subplebbitAddress?: string };
|
||||
const resolvedCommunityAddress = nextCommunityAddress ?? legacyCommunityAddress ?? baseOptions.communityAddress;
|
||||
const newOptions = {
|
||||
...baseOptions,
|
||||
...restOptions,
|
||||
...(resolvedCommunityAddress ? { communityAddress: resolvedCommunityAddress } : {}),
|
||||
};
|
||||
setPublishPostStore(newOptions);
|
||||
},
|
||||
[createBaseOptions, setPublishPostStore],
|
||||
|
||||
Reference in New Issue
Block a user