Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby): account for edge case when payload of DELETE_NODE is undefined #27929

Merged
merged 1 commit into from
Nov 9, 2020

Conversation

vladar
Copy link
Contributor

@vladar vladar commented Nov 9, 2020

Description

Turns out a payload of the DELETE_NODE action can be undefined in some edge cases (no idea when exactly). And refactor from #27504 didn't account for this. This causes Cannot read property 'id' of undefined' error (again, hard to say in which circumstances).

This PR fixes this problem by using the same strategy as other reducers (just treats this situation as a no-op). Example from other reducer:

case `DELETE_NODE`: {
if (action.payload) {
state.delete(action.payload.id)
}
return state
}

@vladar vladar requested a review from a team as a code owner November 9, 2020 17:39
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 9, 2020
@vladar vladar removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 9, 2020
@vladar vladar added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Nov 9, 2020
@gatsbybot gatsbybot merged commit d3471e0 into master Nov 9, 2020
@delete-merged-branch delete-merged-branch bot deleted the vladar/fix-delete-node branch November 9, 2020 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants