mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(pending-post): keep retrying failed posts on the pending route (#1161)
* fix(pending-post): keep retrying failed posts on the pending route Retrying a failed post deletes the pending row before republishing, which briefly leaves the pending comment non-addressable with no active challenge — the same state PendingPost's abandoned-challenge guard uses to redirect back to the board. A shared use-failed-post-retry-store marks the index being retried so PendingPost skips that redirect until the republished row is created and its own navigation to the new pending route takes over. * fix(pending-post): harden retry flag lifecycle against abandoned-challenge race Address Cursor Bugbot review on the retry flow. Clear the retry flag (and isRetryRedirectPending) when the republish challenge is abandoned so an abandon mid-retry falls through to the normal board redirect instead of stranding an empty pending view. Also navigate to the new pending row before clearing the flag in the redirect effect so PendingPost never observes an old-index route with the flag already cleared.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
interface FailedPostRetryState {
|
||||
// Account-comment index of the failed post currently being retried, or null when no retry is in flight.
|
||||
// Retrying deletes the old pending row and republishes, so the pending route briefly has no addressable
|
||||
// comment and no active challenge. The pending view reads this to avoid mistaking that gap for an
|
||||
// abandoned challenge and redirecting away.
|
||||
retryingAccountCommentIndex: number | null;
|
||||
startRetry: (accountCommentIndex: number) => void;
|
||||
endRetry: () => void;
|
||||
}
|
||||
|
||||
const useFailedPostRetryStore = create<FailedPostRetryState>((set) => ({
|
||||
retryingAccountCommentIndex: null,
|
||||
startRetry: (accountCommentIndex) => set({ retryingAccountCommentIndex: accountCommentIndex }),
|
||||
endRetry: () => set({ retryingAccountCommentIndex: null }),
|
||||
}));
|
||||
|
||||
export default useFailedPostRetryStore;
|
||||
Reference in New Issue
Block a user