Skip to content
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

How to rerender a field value in the show by listening to a broadcast #3494

Open
pjmuller opened this issue Dec 6, 2024 · 2 comments
Open

Comments

@pjmuller
Copy link

pjmuller commented Dec 6, 2024

Feature

See loom https://www.loom.com/share/aab4da4104b541c2bb80f45fef000f5d

Goal: update the value on a page without having to refresh it

In short

  • does avo already listen for some broadcasts to dynamically update a single field in the SHOW view?
  • if yes, where should I broadcast the updated HTML to?
  • if not
    • is there a monkey patch way to achieve this?
    • and/or can you outline how us (or someone else of the community) can create a PR to support this more natively?
@Paul-Bob
Copy link
Contributor

Paul-Bob commented Dec 9, 2024

Hi @pjmuller we already did some experimental development in this direction and found out that is not that simple as it seems


does avo already listen for some broadcasts to dynamically update a single field in the SHOW view?

No, right now there isn't any component that is listening from broadcast.

is there a monkey patch way to achieve this?

Ejecting the components and implement a broadcast listener


and/or can you outline how us (or someone else of the community) can create a PR to support this more natively?

The main challenge we encountered was selecting the appropriate field/resource and ensuring that every object required to render a field is properly set up.

When a page is rendered, there's some behind-the-scenes logic that configures the resource, fetches the fields, and so on.

For broadcasting, we need to execute all of that logic again and make sure that the field and all related objects are in the same state they were in when the page was first rendered. This is critical, as the field might include a format_using block or other logic that influences the rendered value.

In conclusion, there's no simple or well-defined approach I can recommend at this moment, but we would love to support this use case.

Copy link
Contributor

This issue has been marked as stale because there was no activity for the past 15 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants