mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 14:16:39 +01:00
Pass UID across composer popups
This commit is contained in:
parent
adcea89a25
commit
162fc7ad07
2 changed files with 9 additions and 3 deletions
|
@ -81,8 +81,8 @@ function Compose({
|
|||
}) {
|
||||
console.warn('RENDER COMPOSER');
|
||||
const [uiState, setUIState] = useState('default');
|
||||
const UID = useMemo(() => uid(), []);
|
||||
console.log('Compose UID', UID);
|
||||
const UID = useRef(uid());
|
||||
console.log('Compose UID', UID.current);
|
||||
|
||||
const currentAccount = getCurrentAccount();
|
||||
const currentAccountInfo = currentAccount.info;
|
||||
|
@ -178,6 +178,7 @@ function Compose({
|
|||
}
|
||||
if (draftStatus) {
|
||||
const {
|
||||
uid,
|
||||
status,
|
||||
spoilerText,
|
||||
visibility,
|
||||
|
@ -186,6 +187,7 @@ function Compose({
|
|||
poll,
|
||||
mediaAttachments,
|
||||
} = draftStatus;
|
||||
UID.current = uid;
|
||||
const composablePoll = !!poll?.options && {
|
||||
...poll,
|
||||
options: poll.options.map((o) => o?.title || o),
|
||||
|
@ -384,6 +386,7 @@ function Compose({
|
|||
editStatus,
|
||||
replyToStatus,
|
||||
draftStatus: {
|
||||
uid: UID.current,
|
||||
status: textareaRef.current.value,
|
||||
spoilerText: spoilerTextRef.current.value,
|
||||
visibility,
|
||||
|
@ -459,6 +462,7 @@ function Compose({
|
|||
editStatus,
|
||||
replyToStatus,
|
||||
draftStatus: {
|
||||
uid: UID.current,
|
||||
status: textareaRef.current.value,
|
||||
spoilerText: spoilerTextRef.current.value,
|
||||
visibility,
|
||||
|
@ -630,7 +634,7 @@ function Compose({
|
|||
);
|
||||
} else {
|
||||
newStatus = await masto.v1.statuses.create(params, {
|
||||
idempotencyKey: UID,
|
||||
idempotencyKey: UID.current,
|
||||
});
|
||||
}
|
||||
setUIState('default');
|
||||
|
|
|
@ -74,6 +74,8 @@ function App() {
|
|||
);
|
||||
}
|
||||
|
||||
console.debug('OPEN COMPOSE');
|
||||
|
||||
return (
|
||||
<Compose
|
||||
editStatus={editStatus}
|
||||
|
|
Loading…
Reference in a new issue