Block Directory: Add error messages inline.#20001
Block Directory: Add error messages inline.#20001StevenDufresne merged 11 commits intoWordPress:masterfrom
Conversation
|
Interesting exploration. It looks slightly different than the design posted by @melchoyce where she described the proposed installation flow as follows:
You can see the video presenting it in action in the I couldn't find any GitHub issue linked so I would be curious to learn what benefits do you see for this flow over the one posted by @melchoyce. |
|
@gziolo Hey! This experiment was initiated based on an item in this Issue:
In order to use inline notices, we need to maintain the |
|
@StevenDufresne this is all looking great. Having the error msgs inline with the popover work well. My only hesitation here is the "Adding" button with the stripes. It's hard to tell, but does it follow the similar stripe pattern found in the "Publish" button? Adding stripes: Publish stripes |
|
@mapk Thanks for the input.
Yeah, I was looking for the 'save' paradigm but it doesn't exist since everything to this point is instantaneous or quietly async. That is the only moment where the user is alerted that something is in progress. Do you know of any save/loading examples in component/flows that have passed this test? |
|
Nice! The functionality is built into the |
898a711 to
715eedf
Compare
|
I've rebased & refactored this a bit:
It seemed easier than going back and forth on reviews, but feel free to revert or discuss anything I did :) For reference, this is what this PR currently looks like: |
|
@ryelle Changes looks good. I fixed some broken tests and removed one. I'm not sure what the best way is to test whether the |
|
I couldn't figure out how to get an error message, and the adding of the block happened so fast, I didn't see any loading UI. <- All that actually makes for a pretty good PR. Thanks y'all. |
|
I've got another PR in the works that further cleans up these actions & adds testing, so I think we could merge this one as-is, since it does have some test coverage. @StevenDufresne What do you think? |
I'm good with that. |
7fea9d1 to
ca0f8a6
Compare
There was a problem hiding this comment.
Looks good, @StevenDufresne you can merge this now 🙂 — the testing follow up PR is #22388
This prevents some prop-drilling by getting the notices when we need them
This prevents some prop-drilling by getting the loading status when we need it
This consolidates the install logic into one callback function, simplifying the list component
ab91c99 to
30a33e2
Compare







This PR was originally here: #19589
I opened the changes here after foolishly rebasing + merging and mangling history.
Applicable comments were made here:
https://github.com/WordPress/gutenberg/pull/19589/files/2da9406051d66e0bea2fe8590d305db924da6002
Description
This PR is an experiment to add inline error messages to the block directory. This PR also introduces a change in execution that needs discussion.
Background Info
downloadthe assets (which means we inject scripts into the DOM)installthe assets by calling an API rest endpoint (.... the plugin ends up in their plugins folder)downloadtheninstallas a callback.downloadsequence, the block is registered which closes the menu (because the way the inserter works) and then theinstallis executed with the menu closed. Should any issues arise, the error message will appear with a bit of a delay.installwe offer them a button and allow them to remove the block.Types of changes
Changes:
Along with the obvious changes to add errors inline, this PR changes the order of execution. Instead of immediate injecting the assets in the
downloadsequence and then installing. This PR firstinstallsand thendownloads.Why?
downloadphase (the block registers and update the state). This means that if an error is throw on install, the context has already changed. We can't show anything inline, it's gone.installthere isn't much recourse to fix it. Now, or potentially in the future. This means we have a broken plugin in the document. We therefore would need to have a robust "removal" experience. By flipping it, nothing is added until everything is :100 with the server.Cons
install(subject to the network speed)Known Issues
onSelect, but it has a lower priority and depending on the state of the app, you could see a bit of a flicker. I have seen it sporadically.Screenshots
How has this been tested?
Manual Testing
Manual test were done by doing the following: ( using these block: Card, Boxer, Listicle)
Case Success
a. Notice that the block is added to the document without error
b. Notice that the plugin is not in the regular WordPress plugin folder
Case Install Error:
a. Make the
/installendpoint return an error on first callb. Notice the error message is showing with the proper copy..
a. Notice the error message is removed
b. Notice the plugin is in WordPress plugin folder
Case Download Error:
a. Add a throw statement in the download function in
action.jsto mimick and issue with adding assets to the DOMb. Notice the error message is showing with the proper copy.
Checklist: