In context_reaction_block.inc
, the function get_blocks will generate a new list of all the blocks for a given region or load the data from Context's own cache. After this cache is generated, saving a block that is included in an existing context will NOT have the changes show until Context's cache is rebuilt.
Steps to reproduce:
- Add a block to a context as a reaction (this block is not cached by default)
- Edit the block and change its title, and save
- View page w/ context containing block
- Block is shown with old title
- Either manually flush all caches, or re-visit the context admin page (which triggers a cache flush)
- View page again
- Observe new title
Note that this also affects modules that implement hook_block_info_alter
like blockcache_alter
module, which changes the caching of a block before it's saved.
A workaround for this is to clear all caches or trigger a Context cache flush by re-saving a Context or visiting the context admin page.
I think the solution may be to add a submit handler to the block save form which will clear the context block cache.
Thoughts?
Comment | File | Size | Author |
---|---|---|---|
#3 | context-2130655-update-block-info-3.patch | 700 bytes | eelkeblok |
Comments
Comment #1
bkosborneComment #2
bkosbornechanged repro steps to be more generic
Comment #3
eelkeblokI took a stab at solving this. This is the most basic change I could come up with, but I'm wondering if it doesn't make more sense to simply have the get_blocks method of the block reaction listen to and update the rebuild_needed status directly, instead of having to pass it as the rest input and having to follow the call to get_blocks() with a rebuild_needed(FALSE). I can't think of any situations where get_blocks should use the cached block-info even though a rebuild is needed.
BTW, background: rebuild_needed is set through a form alter in context.core.inc when a block is updated, so it serves as a flag indicating block info has changed.
Also, this patch is generated against release 3.3 which happens to be the version my client's site is running. I'm running out of time, but I hope it applies to HEAD as well. If not, I'll reroll at a later time.
Comment #4
kreynen CreditAttribution: kreynen commentedThis patch solved the issue for me. Still testing to see if it causes any other issues.
Comment #5
kevincrafts CreditAttribution: kevincrafts commentedI also tested this patch on some sites and it solved the issue for me as well.
Comment #6
rooby CreditAttribution: rooby commentedAre there any performance implications to this fix? Are the context caches only being cleared when a block has been changed?
(I am not familiar with the code myself)