Skip to content

openRequestInfo() relies on a fixed setTimeout(150) to prefill/focus fields, but openDetail() is async (fetch + DOM update) so the timeout can fire before the modal inputs exist (especially on slow networks). Make openRequestInfo async and await openDetail(id) (or otherwise signal when the modal is rendered) before reading/writing #cMsg/#cName. #8642

@malickland-304

Description

@malickland-304

openRequestInfo() relies on a fixed setTimeout(150) to prefill/focus fields, but openDetail() is async (fetch + DOM update) so the timeout can fire before the modal inputs exist (especially on slow networks). Make openRequestInfo async and await openDetail(id) (or otherwise signal when the modal is rendered) before reading/writing #cMsg/#cName.

async function openRequestInfo(id, address) {
  await openDetail(id);
  const msg = document.getElementById('cMsg');
  if (msg && !msg.value) msg.value = `I'd like more information about: ${address}`;
  const nameEl = document.getElementById('cName');
  if (nameEl) nameEl.focus();

Originally posted by @Copilot in malickland-304/wv-property-intelligence#16 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions