- This topic has 0 replies, 1 voice, and was last updated 3 weeks, 6 days ago by .
I'm not sure if it's an issue, but I noticed the following problem:
(note that my local server is not super fast, maybe this is not happening on a fast production server but still it could potentially be problematic)
- I created by code with the rwmb_meta_boxes filter a metabox type 'block' ('context' => 'side', render_template and enqueue_style set to external files) with a single field 'type' => 'checkbox'
- when I click/edit the block on my page, I see my checkbox field on the right
- when I check/uncheck it and click on page "Update", the last state of the field is not properly saved unless the rendering of the block occured on the page before you hit the "Update" button
Note that when the "loading" animation (dot turning in a disc when waiting for http response to render the block) has finished turning, hitting again "Update" button is finally saving the page right.
Maybe the "Update" button should be somehow disabled until the http request for previewing the block change return a OK status. As I understand it is at that moment that the "code" in the page really change and then allows WP to save the actual generated content with the fields value. Otherwise it cannot save the fields value as it is not yet processed.
Any advice on that?
I guess I could avoid using external files (render_template, enqueue_style) to make the response faster and mitigate the problem, but IMO it doesn't solve totally the problem as depending on the server's response time sometime the page could be "randomly" uncorrectly saved if the blocks were or not rendered.
By the way I noticed that the rendering of MB Blocks (in the back-office) is way slower than the core "react" way. I guess that's the payload for not coding it in js 😉
- You must be logged in to reply to this topic.