create-guten-block icon indicating copy to clipboard operation
create-guten-block copied to clipboard

can only edit block one time

Open brothman01 opened this issue 5 years ago • 7 comments

I can only make changes to the js of the block one time. I think I must be missing a step in my development process.

npx create-guten-block my-block cd my-block npm start make edits ^c npm run build block appears in the editor and on the page with any edits I made.

npm start make edits ^c npm run build block appears the same as before without the edits I made.

what do I need to do so that my second round of edits will be built into the block?

brothman01 avatar Apr 15 '19 23:04 brothman01

Could be browser or caching / environment related. Are you refreshing the browser page? There is no hot module replacement in CGB currently.

isvictorious avatar Apr 18 '19 18:04 isvictorious

I am refreshing the browser page and emptying the cache so idk what the issue is. Although I have written several plugins in PHP, my react experience so far is mostly this. Am I using the commands correctly or should I be running one to clean the npm building cache or something because that seems to be the missing piece. Unless I have to eject the block first before I can edit and rebuild it?

brothman01 avatar Apr 18 '19 22:04 brothman01

I'm experiencing a similar issue @brothman01 - I can make updates the the original block that was generated by CGB, and those changes are reflected. However, if I create a second block, and include it in the blocks.js (using import) – for some reason I can never get the second block to appear.

Worth mentioning that this was all working a few months back, so I wonder if a WordPress version change is the culprit.

wrydere avatar Oct 07 '19 20:10 wrydere

Feel free to send in PRs to fix this.

ahmadawais avatar Oct 07 '19 20:10 ahmadawais

@ahmadawais I'll dig around and see if I can sort it, and if I can I will submit. Thanks for your efforts with CGB!

wrydere avatar Oct 07 '19 20:10 wrydere

Any news on this one? I still have the issue.

lassenorgaard avatar Apr 27 '20 11:04 lassenorgaard

This seems to be a caching issue. Not sure if its browser or WP, but a quick hack is adding cache busting to wp_register_script by adding the current time as a url var: plugins_url( '/dist/blocks.build.js?'.time(), dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.

Glish avatar Sep 26 '20 09:09 Glish