sapper icon indicating copy to clipboard operation
sapper copied to clipboard

Large Data URI Encoded images cause subsequent components to be rendered multiple times

Open dabbers opened this issue 4 years ago • 2 comments

Describe the bug When inserting an image with a large data uri encoded image, any subsequent components being included in the response will get rendered twice. This is easiest to reproduce when fetching and inserting content via fetch. I noticed this bug by having a link to the same page (/news/[slug].svelte) with a different slug. This caused the components after the large image to be rendered twice.

To Reproduce

  • In src/routes/blog/_posts.js Add an img alt="sample" src="" tag to any blog post you'd like where the value of src is from https://onlineimagetools.com/convert-image-to-data-uri
  • In _layout.svelte Add a second <Nav /> below the . Any component will work, but with a base template, Nav is readily available.
  • npm run dev
  • Visit the /blog/ of the blog post you added the to.
  • Hit refresh (ctrl+r) on your browser.
  • If possible, we recommend creating a small repo that illustrates the problem. See: https://github.com/dabbers/test-content
  • npm install
  • npm run dev
  • load /blog/what-is-sapper in your browser
  • Hit refresh image

image

Expected behavior I expect the subsequent components not to be rendered again. Since they aren't changing and the page hasn't changed.

Information about your Sapper Installation:

  • The output of npx envinfo --system --npmPackages svelte,sapper,rollup,webpack --binaries --browsers npx: installed 1 in 0.918s

    System: OS: Windows 10 10.0.19041 Memory: 17.22 GB / 31.95 GB Binaries: Node: 12.18.3 - C:\Program Files\nodejs\node.EXE npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.423.0), Chromium (87.0.664.47) Internet Explorer: 11.0.19041.1 npmPackages: rollup: ^2.3.4 => 2.33.3 sapper: ^0.28.0 => 0.28.10 svelte: ^3.17.3 => 3.30.0

  • Your browser Edge Chromium Version 87.0.664.47 (Official build) (64-bit)

  • Your hosting environment (i.e. Local, GCP/AWS/Azure, Vercel/Begin, etc...) Windows 10

Severity This is moderate impact. It's adding a second footer and sometimes duplicated related articles to my page that persist until the server is restarted or a hard refresh (haven't nailed down which one actually clears it).

dabbers avatar Nov 25 '20 22:11 dabbers

I tried reproducing this on the standard Svelte template, but could not get it to reproduce. So I suspect it has something to do with Sapper's client vs server side rendering.

dabbers avatar Nov 30 '20 03:11 dabbers

By dropping my template svelte and sapper versions to:

        "sapper": "^0.27.16",
        "svelte": "^3.0.0",

The issue went away. This might help narrow down a potential issue. When I keep svelte to 3.0.0, but move sapper back to 0.28.0, the issue returns, indicating an issue occuring between those 2 versions. I also tested with 0.28.10 but the issue remains. I'd drop down to 27.16 but I'm already pretty far along with Typescript so cannot drop down.

dabbers avatar Dec 01 '20 03:12 dabbers