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

turbo didn't get noticed of new content #1236

Open
matias-carpintini opened this issue Mar 31, 2024 · 0 comments
Open

turbo didn't get noticed of new content #1236

matias-carpintini opened this issue Mar 31, 2024 · 0 comments

Comments

@matias-carpintini
Copy link

matias-carpintini commented Mar 31, 2024

i'm adding links with a stimulus controller and the insertAdjacentHTML function. when i click on those links, the request is made with HTML, not Turbo. prefetch does works tho.

i tried with a turbo_frame_tag, and doing frame.reload() after insertAdjacentHTML, same result.

any idea on how can i make this work?

the inserted html has no tricks:

populateDropdown(event) {
  const professionalId = event.target.getAttribute("data-professional-id");
  const dateTime = event.target.getAttribute("data-datetime");

  // Use professionalId and datetime to fetch or generate the dropdown content
  const dropdownContent = `
    <a href="/appointments/new?professional_id=${professionalId}&starts_at=${dateTime}" data-turbo-frame="slideover" data-action="click->agenda-opts#handleTurboClick">
      Click here
    </a>
  `;

  this.dropdownElement.insertAdjacentHTML("beforeend", dropdownContent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant