Skip to content

Commit

Permalink
querySelectorAll -> querySelector
Browse files Browse the repository at this point in the history
  • Loading branch information
maximpertsov committed Dec 4, 2023
1 parent a6bb2c6 commit 9763583
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions rpc/examples/echo/frontend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ declare global {
}

function createElemForResponse(text: string, method: string, type: string) {
const elems = document.querySelectorAll(`[data-testid="${type}-${method}"]`);
const inner = document.createElement('div');
inner.innerText = text
elems[0].appendChild(inner)
const selector = `[data-testid="${type}-${method}"]`;
const elem = document.querySelector(selector);
if (!elem) {
throw new Error(`expecting to find selector '${selector}'`);
}
const inner = document.createElement("div");
inner.innerText = text;
elem.appendChild(inner);
}

async function getClients() {
Expand Down

0 comments on commit 9763583

Please sign in to comment.