Repository navigation
Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
There was a problem hiding this comment.
@aaronrobertshaw We are still outputting a JetpackFieldLabel component just above as part of this block.
Given the new field structures in your PRs, I think we'd just (a) remove that JetpackFieldLabel component and (b) update the InnerBlocks to contain Label + Dropzone instead of just Dropzone. I would think we can just update this file after your work is merged, but before the file upload block is fully released/exposed to users.
If helpful, as a test, I could create a draft PR, branched off your work, that contains the file upload and dropzone blocks as they are in this PR, but with the change above for InnerBlocks, to confirm it works as expected?
There was a problem hiding this comment.
That sounds right to me.
A block can only have one set of inner blocks. Given we are moving to inner blocks for all fields, this file field will need to have a single set of inner blocks which as noted would be the Label + Dropzone blocks.
I would think we can just update this file after your work is merged, but before the file upload block is fully released/exposed to users.
This is the main point of friction between the concurrent work on inner blocks and the file field, making sure they are aligned here so that there is only a single roll out of the file field and it doesn't immediately require a deprecation to migrate inner blocks.
If helpful, as a test, I could create a draft PR, branched off your work
I think that would be great. It should help accelerate bringing things together.
Also, the inner blocks isn't "my" work, we all need to own it as in a couple of weeks I'll be AFK for a few months.
There was a problem hiding this comment.
One other note, if you're basing the proposed PR off #42889, that PR doesn't register the new inner blocks yet. That's done in #42890 mostly due to trying to draw a line such that the new blocks weren't exposed or used until ready.
That might change soon though if we do want to develop with the new blocks such as with the file field.
There was a problem hiding this comment.
I can move this file out of it's own folder since it is just one file now. Convention in this package would just be to rename this file jetpack-field-file.js and put it directly under components/
I partly wanted to keep it to ensure a cleaner diff for comparison for now.
There was a problem hiding this comment.
That definitely works for me. I'll keep it in its own folder.
There was a problem hiding this comment.
Sounds like a plan 👍
I think it makes more sense if the file field is updated to use complete inner blocks i.e. the Label block too. Then all blocks using the inner blocks structure will have their own folder as per #42890.
aaronrobertshaw
left a comment
There was a problem hiding this comment.
Thanks for the work here @edanzer, it's a great start 👍
The more I looked at the changes here the more it seems like the best approach would be to create the PR using the new inner blocks you proposed earlier.
A few other random thoughts:
- The label doesn't render in the frontend but that also seems to be a problem on trunk. Either way, I'd expect that needs fixing.
- Saving a post with the file field block in it and reloading loses the content of the dropzone block.
- The inner image results in a block validation error which might explain the above lose of content appearing in the editor
- It's probably better to consistently use hooks for block props and inner block props rather than mix-and-match between useInnerBlocksProps and InnerBlocks. It makes the blocks much harder to reason about and debug.
- The Dropzone block itself should represent the container for its inner blocks rather than adding extra unnecessary markup. This would also provide more control e.g. the Group block offers positioning controls and block styles etc that don't make a lot of sense in the context of the dropzone block.
- The dropzone block could contain the default styles applied to the group by adding them as a block attribute default e.g. attributes.style.default
- The dropzone block can then also adopt the block supports that make sense for it via
supports.
is-style-defaultshouldn't be manually added anywhere the default block style is really the absence of a selected block style. It's a bit of a Gutenberg quirk thatis-style-defaultgets added when toggling block styles on and off.
It might be easier to implement the full inner blocks approach (using the proposed Label block) and follow the examples set in #42890. I suspect rendering extra markup around the inner blocks content while also making the block wrapper the sole container could be tricky.
|
To help get the ball rolling on the alternate PR proposed, I've thrown up a quick exploration based off #42890. Hopefully, that might help inform or assist with creating the new PR. Feel free to use or discard any of that as you see fit @edanzer |
2c3c0cf to
bfc6467
Compare
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Code Coverage SummaryCoverage changed in 2 files.
1 file is newly checked for coverage.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
61d0900 to
9c4a6ab
Compare
|
Closing in favor of #43114 |
Alternative on top of global styles refactor:
Proposed changes:
The new file upload block was done in a way that's compatible with the upcoming refactor to form fields (see here and here).
Summary:
NOTE: As the file field block is not yet released I did not worry about backward compatibility or deprecation or migration of blocks. So past file upload blocks you've inserted on test forms will likely no longer work.
Other information:
Jetpack product discussion
There's a good discussion on Slack here: p1743497100111579-slack-C086RGTJT1D
There's a very good summary in the video call in that thread around the 41 minute mark.
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
This is a refactor. The underlying blocks are different, but otherwise the block should behave the same way on the frontend and editor.