-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Store: Product Trash Pickup #21810
Store: Product Trash Pickup #21810
Changes from 1 commit
64fefad
19942a5
aa2d729
f461134
7189965
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import React, { Component } from 'react'; | |
import config from 'config'; | ||
import i18n from 'i18n-calypso'; | ||
import PropTypes from 'prop-types'; | ||
import { trim, debounce, isNumber } from 'lodash'; | ||
import { trim, isNumber } from 'lodash'; | ||
|
||
/** | ||
* Internal dependencies | ||
|
@@ -45,7 +45,6 @@ export default class ProductFormDetailsCard extends Component { | |
|
||
this.setName = this.setName.bind( this ); | ||
this.setDescription = this.setDescription.bind( this ); | ||
this.debouncedSetDescription = debounce( this.setDescription, 200 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When trying to track down this bug, this did jump out at me - what was the original reason for this logic? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure now, sorry. It doesn't seem necessary from the testing I did though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it was added in here #14944 though i don't see any details around that specific bit. I think this might be some carry-over from patterns in the post editor maybe. But I agree if its not needed, it is great to remove it. |
||
} | ||
|
||
// TODO: Consider consolidating the following set functions | ||
|
@@ -108,7 +107,7 @@ export default class ProductFormDetailsCard extends Component { | |
return ( | ||
<CompactTinyMCE | ||
initialValue={ product.description || '' } | ||
onContentsChange={ this.debouncedSetDescription } | ||
onContentsChange={ this.setDescription } | ||
/> | ||
); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm groking the check for
! product
but the second clause has me thinking a bit - so this is to short circuit thecreate
view if aproduct
exists and is not a placeholder/un-saved product?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah.
I found in testing, the few actions that clear away edits in product UI state, variations, etc (which also resets
currentlyEditingId
and thisproduct
object) might not have all ran yet before the component mounts. And because of how the CompactTinyMCE component works, (it only an initial value), this is needed to prevent rendering of the form in that brief moment of time. Once the prop updates the form renders.