-
-
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
Update tunes
data when new tunes
data is provided
#2720
base: next
Are you sure you want to change the base?
Conversation
AFAIK, when you update block using `editor.blocks.update` method, only `data` attribute is merged and updated. I believe `tunes` data should be updated if provided.
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.
Please, add a corresponded testcase
Update `tunes` data when new `tunes` data is provided
I have added a test. In order to prevent breaking change, I decided to add new parameter called |
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.
Almost ready to approve, please check the last comment and add a changelog
src/components/modules/api/blocks.ts
Outdated
*/ | ||
public update = async (id: string, data: Partial<BlockToolData>): Promise<BlockAPIInterface> => { | ||
public update = async (id: string, data: Partial<BlockToolData>, tunes?: {[name: string]: BlockTuneData}): Promise<BlockAPIInterface> => { |
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.
What if I want to update only tunes? I think the data should be optional as well.
One of "tune" or "data" should be provided.
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.
@neSpecc I have updated the code. I think it should just return provided block if neither new block data nor tunes data is provided in order to skip redundant and unnecessary update. What do you think about it?
AFAIK, when you update block using
editor.blocks.update
method, onlydata
attribute is merged and updated. I believetunes
data should be updated if provided.