-
Notifications
You must be signed in to change notification settings - Fork 18
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
Abstract Block class not updating ACF fields #200
Comments
Hi Fran, can you please explain this with a code sample? Does this only happen on local or on the server too? It also sounds like a cache issue, so can you check that object caching, etc is deactivated. |
`class Accordion extends AbstractBlock {
} if I initially create the above block, and then I want to change any data of the arguments of the functions do_registration() or the get_fields(), the change is not reflected. for example, when changing the alignment, the ui template or the acf key: `class Accordion extends AbstractBlock {
}` I've tried clearing the cache by adding this to the lando file (then restarting lando): but it doesn't work. The only way the changes take effect is when I restart lando or wating a long time. |
Have you tried disabling / clearing object caching (redis / memcached / any
object caching setup in WordPress)? I remember we had a similar issue
before.
…On Wed, 24 Jun 2020 at 11:54, Francisco Giraldo ***@***.***> wrote:
`class Accordion extends AbstractBlock {
/**
* Register the block.
*
* @return array
*/
public function register() : array {
return $this->do_registration(
[
'description' => 'Adds an accordion to your page.',
'icon' => 'sort',
'category' => 'common-blocks',
'template_type' => 'molecule',
'template_name' => 'accordion/accordion',
'wrapper_elem' => 'div',
'alignment_options' => true,
]
);
}
/**
* Re-format the fields to the format required by the UI component.
*
* @param array $block The block settings and attributes.
* @param string $content The block inner HTML (empty).
* @param boolean $is_preview $is_preview True during AJAX preview.
* @param integer $post_id Id of the current post.
* @return array
*/
protected function get_fields( array $block, string $content, bool $is_preview, int $post_id ) : array {
return [
'items' => get_field( 'items' ) ?? [],
];
}
}
`
if I initially create the above block, and then I want to change any data
of the arguments of the functions do_registration() or the get_fields(),
the change is not reflected.
for example, when changing the alignment, the ui template or the acf key:
`class Accordion extends AbstractBlock {
/**
* Register the block.
*
* @return array
*/
public function register() : array {
return $this->do_registration(
[
'description' => 'Adds an accordion to your page.',
'icon' => 'sort',
'category' => 'common-blocks',
'template_type' => 'molecule',
'template_name' => 'accordion/accordion2',
'wrapper_elem' => 'div',
'alignment_options' => false,
]
);
}
/**
* Re-format the fields to the format required by the UI component.
*
* @param array $block The block settings and attributes.
* @param string $content The block inner HTML (empty).
* @param boolean $is_preview $is_preview True during AJAX preview.
* @param integer $post_id Id of the current post.
* @return array
*/
protected function get_fields( array $block, string $content, bool $is_preview, int $post_id ) : array {
return [
'items' => get_field( 'items_2' ) ?? [],
];
}
}`
I've tried clearing the cache adding this to the lando file:
cache: false
edge: false
but it doesn't work.
The only way the changes take effect is when I restart lando.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#200 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGVRH6RHCAIFK6KWP4LVODRYIVSXANCNFSM4OF4Y2UA>
.
|
yes, I added this 2 no cache flag to the lando file: cache: false I initially thought it had solved the issue |
I can only think that some sort of persistent object cache is running. A
couple of things you could try out next time you get this problem:
- Run this
https://developer.wordpress.org/reference/functions/wp_cache_flush/
- install debug bar and use it to check what's in the cache
https://wordpress.org/plugins/debug-bar/
Could you try these and let me know what you find?
…---
Adam Fenton
CTO & Co-founder
On Wed, 24 Jun 2020, 13:34 Francisco Giraldo, ***@***.***> wrote:
yes, I added this 2 no cache flag to the lando file:
cache: false
edge: false
I initially thought it had solved the issue
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#200 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGVRH6BHZTWYG5NMWYRNGTRYJBJ3ANCNFSM4OF4Y2UA>
.
|
I've found, since the implementation of the Abstract block class, very difficult to see the changes when the get_fields() function is changed.
For some reason this implementation doesn't let see the changes immediately.
For example, if I update the ACF fields for a block, and then update the function get_fields() from the block file, the changes don't appear.
Sometimes I have to wait hours to see the change reflected.
The text was updated successfully, but these errors were encountered: