Closed Sardis93 closed 1 year ago
Makes sense, thank you @Sardis93
Hi, I was directed to this as I had some (very!) peripheral involvement in the earlier issue (#35) but was on vacation. My understanding is that Renderer::render()
is not directly the problem: if we take the resulting markup and display it on the page, the placeholders will be replaced. I think the underlying problem is that we don't directly display the result on page, we pass it as an attached JS setting, where placeholders won't get replaced. I think one solution would be to render the pins to a hidden area and let the JS clone them from there.
I think a potential problem with the current solution using renderPlain()
is that we discard the attachments (css, js, cacheability metadata) of the rendered node.
Hi, @andriokha !
I believe we don't need the attachments anyway, since we only need the actual data coming from teaser view mode. Any and all styling/js should be attached through the openy_map theme function. What do you think?
Hi @Sardis93!
Any and all styling/js should be attached through the openy_map theme function
I don't think that's an assumption the distro can really make. I think it's valid for a developer to override a branch teaser template and use attach_library
but IIUC currently that won't work. And there's also cacheability metadata, which can be a real pain to debug. It's true that a common usecase is to have a teaser listing beneath the map, in which case the listing view solves most (all?) issues described, but if I use the map alone and update the template to use a custom library, I'd expect that to fail.
After update of ycloudyusa/yusaopeny package to 10.2.14.1 the location pins no longer have today's hours displayed: This is because the today's hours are rendered using lazy_builder, similarly to the https://git.drupalcode.org/project/lb_branch_hours_blocks/-/blob/1.1.x/src/Plugin/Block/BranchHoursBlock.php?ref_type=heads#L184 and the markup looks like this:
From what i can gather, the placeholder is not rendered because we use
$this->renderer->render()
: https://github.com/open-y-subprojects/openy_map/blob/main/src/OpenyMapDataWrapper.php#L61Earlier, it was renderRoot(): https://github.com/open-y-subprojects/openy_map/commit/952882f819bf788f675e8c43a735dbc1b17c91df But it caused another problem: https://github.com/open-y-subprojects/openy_map/issues/35 So i propose to use
renderPlain()
, this way the placeholders are rendered and no bubbling of attachments happens.