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
Duplicated ACF blocks includes always the same block id #301
Comments
In another case, if I duplicate the block with the gutenberg toolbar, the block id has been automatically changed. |
@elliotcondon a workaround is to remove the ACF block id from the pattern like the following example:
If the block id is empty But is this the correct way to remove the block id from the pattern? |
Thanks for the topic. Yes, you're instinct to remove the "id" attribute was correct. Each block within the post_content should contain a unique "id" value, and any kind of template such as "patterns" or "examples" should not. The "id" is used by ACF to setup and scope the "data" when using template functions such as I'll add this to our to-do list - to perform testing with the upcoming Patterns library 👍 |
These are my finding - (Conclusion - this is NOT an issue for me...) Tested with:
Adding 2 of the same patterns it is true that both patterns start with the same block Ids. HOWEVER, the moment I make any changes to any of the blocks (save the page and refresh by going on the front end and editing the page again), the block ID changes automatically, therefore I CAN NOT have a situation where I make changes to one pattern, and those changes reflect on the other (pattern). I can verify the block ID changes by going from the visual view to code view in the editor, before and after I make any of the changes in the patterns. Could it be that Gutenberg 8.2 fixed this issue if it existed to begin with? I don't know, and at this point we should not really care either, unless I'm missing something... @CreativeDive and @elliotcondon can you please test and confirm my findings so we can safely move away from this issue? Thanks, |
@nick6352683 Currently I can't say more about it. I work with the latest release of WordPress, because ACF innerBlocks dosen't work with the latest Gutenberg release. So I can say more about it, if ACF 5.9 beta supports the innerBlocks in newer Gutenberg releases. |
Replying to #301 (comment) by @nick6352683 Thanks for jumping into this ticket, but I don't believe there is anything that requires investigation. As mentioned, each block within the post_content should contain a unique "id" value, and any kind of template such as "patterns" or "examples" should not. Please be aware this is not a bug, but something that should be better documented. |
Replying to #301 (comment) by @CreativeDive I can confirm that issue #297 has been fixed, and will be included in the 5.9.0-beta2 release. Additional, I've just sent you an invite to join the ACF PRO private GitHub repository. There, you will find a branch named "feature/release-5-9". Please pull down the latest code from this branch and let me know how you go 👍 |
@elliotcondon Thanks for sending an invite to join the ACF PRO private GitHub repository. I've installed the "feature/release-5-9" branch, but everything breaks. So I've installed the latest 5.9 beta from the ACF website and the issue is still there :-( If I installed the ACF 5.8.11 everything works perfect. What's wrong here? |
@elliotcondon I can see you have modified this file: https://github.com/AdvancedCustomFields/acf-pro/commit/03b64bb9db3c7d72008bcc08581a1f8004f5b239 But it seems this dosen't work correct. |
Hi @CreativeDive. Can you try hard-refreshing your browser to clear cached assets? I suspect the |
@elliotcondon Yes, really. My bad this was a browser cache issue :-D Now I can confirm, innerBlocks working with the latest 8.2 Gutenberg release :-) |
I just found this issue on one of my clients sites: If you copy a block from another post the ID is not updated as well, so changing field values does not work (or it does work but they are not displayed/output on the frontend). I'm seeing a similar issue with GenerateBlocks, so I am not sure if it's a Gutenberg issue or a plugin issue, probably depending on how the id is generated. EDIT: This was while inserting a reusable block and converting it to a normal block. |
not sure if this is related however I noticed that fields inside my blocks are readonly when I add them among a gutenberg pattern and I am not sure what's causing this. Once I save the post and reload gutenberg all blocks inside the pattern continue to work as expected. I noticed they get aria-role="readonly" for select fields and disabled for input fields set. Any idea what could cause this? |
Thanks @p13rnd. This is a known issue we have identified here: |
Hi Elliot, okay I thought so after going wild with hook orders a bit 🗡️ Cheers, |
I'm trying to add an ACF block to a Pattern and running into this same issue - even if I take out all the attributes (id, align, mode, etc) it still shows as read-only until the page is saved and refreshed. |
Is this fixed with 5.10 ? |
No it's not fixed, just checked with 5.10.1 . |
Seems to be fixed in 5.10.2 |
We did fix this in 5.10.2 :) Thanks for the report! |
I ran into this issue today with 5.12.3. It happens when you copy a block from the code editor and paste it into another post. So I'm not sure if that is part of the scope of this issue, or technically a separate issue. |
I am not sure if this is fixed, because I encountered it just today with ACF 6.2.2. When I Duplicate the block within the page - the content and ID's remain same - content is fine, but ID's is wrong. How to fix this? |
Legacy Block IDs no longer exist inside ACF. When a block is first updated after updating to 6.0, its block ID will be removed and generated from a hash of the settings and field data. If you duplicated a block before editing it, it may have the previous behaviour, but any edits to it will trigger the block ID change. |
You are right, when you duplicate it only, ID's remain same, when I change something, ID changes. So If I need same button multiple times, I should always change it's text, or use reusable block - thats hard for mine users, who are not really IT guys. |
If a block's contents are exactly the same, ACF will see them as the same block ID yeh - but our internal block IDs are not meant to be unique, they're designed for our cache system, so if a block is functionally identical, we want the ID to be the same. If you need a unique block ID for some reason, there are some possible workarounds we've included in the 6.0 release notes |
Ok, thanks for explanation Liam, I really appreciate it. |
Hey Elliot,
with the upcoming WordPress release, the awesome pattern feature is coming. So we can add our own block pattern with ready to use included blocks.
This is an example how we can add this:
While testing this new feature, I've found a problematic issue with the included ACF block id
"id\":\"block_5eccdfd5dfb2d\"
.If I use a pattern which includes an ACF blocks, the block id is always the same --> Also if I use this pattern/block multiple times. So I get multiple ACF blocks with the same block id. This is very confusing. Because, if I change a setting by this ACF block --> The changed setting is also applied to all other ACF blocks, which are included by this pattern.
This happens, because the block id is the same for all ACF blocks, which are included by the pattern.
How we/you can solve this issue to generate automatically a new block id for each ACF block?
The text was updated successfully, but these errors were encountered: