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 comment-creation failure if you have recently deleted a channel #4630

Merged
merged 1 commit into from
Aug 5, 2020

Conversation

infinite-persistence
Copy link
Contributor

Issue

Fixes #4621 Can't create Comments if you recently deleted a channel
Fixes #3013 Impossible to add comments

The channel that the parent passes in is from a persisted state. If the channel has been deleted, <select> will automatically resolve to another selectable value. However, onChange will not be called for this scenario, so we now have a mismatch.

Changes

  • Manually check if the value has been auto-resolved and report it to the parent.
  • An extra setTimeout was needed. It seems like onChannelChange needs to be called after the first useEffect of the parent, otherwise the call has no effect.

## Issue
Fixes `4621 Can't create Comments if you recently deleted a channel`

The `channel` that the parent passes in is from a persisted state. If the channel has been deleted, `<select>` will automatically resolve to another selectable value. However, `onChange` will not be called for this scenario, so we now have a mismatch.

## Changes
- Manually check if the value has been auto-resolved and report it to the parent.
- An extra `setTimeout` was needed. It seems like `onChannelChange` needs to be called after the first `useEffect` of the parent, otherwise the call has no effect.
@neb-b neb-b merged commit 37a1fd8 into master Aug 5, 2020
@neb-b neb-b deleted the ip-comment-channel-mismatch-4621 branch August 5, 2020 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't create Comments if you recently deleted a channel Impossible to add comments
2 participants