fix: set PENDING status on deploy preview request and failure#7756
Merged
martinjagodic merged 1 commit intodecaporg:mainfrom Mar 17, 2026
Merged
Conversation
Clear stale url and status in the deploys reducer on DEPLOY_PREVIEW_REQUEST and DEPLOY_PREVIEW_FAILURE. Both cases now set status to 'PENDING' instead of leaving it undefined, which ensures the 'Check for Preview' button remains visible in the editor toolbar while polling is in progress or after polling gives up. Previously, clearing status to undefined caused the deploy preview controls to disappear entirely (the toolbar's guard clause returns early when status is falsy), leaving editors with no way to manually check for a preview. Adds unit tests for the deploys reducer (none existed before). Fixes decaporg#7755
6588ef6 to
839569b
Compare
yanthomasdev
approved these changes
Mar 16, 2026
Contributor
yanthomasdev
left a comment
There was a problem hiding this comment.
Thanks @jonasbeck, looks solid to me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sets
status: 'PENDING'in the deploys reducer on bothDEPLOY_PREVIEW_REQUESTandDEPLOY_PREVIEW_FAILURE, preventing stale production URLs from appearing and ensuring the "Check for Preview" button remains visible during polling. Adds unit tests for the deploys reducer (none existed before).Problem
When a user opens an existing published entry,
getDeploystores{ status: "SUCCESS", url: "https://production-url/..." }in Redux. If the user then saves (creating an editorial workflow branch),getDeployPreviewpolls for commit statuses. Two issues:SUCCESSstate and production URL persisted, causing "View Preview" to link to the production URL instead of the deploy preview.statustoundefinedcaused the deploy preview controls to disappear entirely —renderDeployPreviewControlshas a guard clauseif (!status) return— leaving editors with no way to manually check for a preview.Fix
case DEPLOY_PREVIEW_REQUEST: { const { collection, slug } = action.payload; const key = `${collection}.${slug}`; - state[key] = state[key] || {}; - state[key].isFetching = true; + state[key] = { isFetching: true, status: 'PENDING' }; break; } ... case DEPLOY_PREVIEW_FAILURE: { const { collection, slug } = action.payload; - state[`${collection}.${slug}`].isFetching = false; + const key = `${collection}.${slug}`; + state[key].isFetching = false; + state[key].url = undefined; + state[key].status = 'PENDING'; break; }DEPLOY_PREVIEW_REQUEST: Resets the entry to{ isFetching: true, status: 'PENDING' }, clearing staleurl/statuswhile keeping the "Check for Preview" button visible.DEPLOY_PREVIEW_FAILURE: Clearsurland setsstatus: 'PENDING'so the button stays visible and clickable for manual retries.Tests
Added
packages/decap-cms-core/src/reducers/__tests__/deploys.spec.ts. Covers:REQUEST,SUCCESS,FAILURE)REQUESTclears stale url and sets status to PENDINGFAILUREclears url and sets status to PENDINGselectDeployPreviewselectorFixes #7755