Trying to set product page image to selected variant without reloading page

My app features a theme app extension that allows users to select a product variant using thumbnails. I’m setting the new selected variant in the url parameter like so

setSelectedVariant({ currentTarget }) {
  const variantId = currentTarget.dataset.variantId;
  const url = `${window.location.pathname}?variant=${variantId}`;
  window.history.replaceState(null, "", url);
}

which works in that the url is successfully updated but the blown-up image on the product page does not update as it does when a variant is selected using the standard variant picker block from Dawn. If I instead update the page url like so

const variantId = currentTarget.dataset.variantId;
const url = `${window.location.pathname}?variant=${variantId}`;
window.location.href = url;

I’m able to achieve this effect but the page also reloads which is not as fluid of an experience. Am I missing something?