Closed leoj3n closed 7 months ago
Note that I was experiencing a similar issue when manually rolling following this repo:
https://github.com/donovanh/svelte-image-loading
So probably not specifically an "Inview" issue. Thanks for any insight, and I thought worth documenting for the solution.
Probably a simple fix but not sure...
Had to change some svelte-specific settings previously configured to make the page prerendered / no javascript.
src/routes/photos/+page.js
:
- import { dev } from '$app/environment';
- export const csr = dev;
- export const prerender = true;
+ export const prerender = false;
I have a hunch this is a problem with the newer version of svelte...
I haven't figured it out so wanted to document the issue here.
package.json
:Using latest versions of things...
If you load the page as production directly, this code breaks (the Grid toggle buttons no longer function):
src/lib/components/InviewSrcset.svelte
:src/routes/photos/+page.svelte
:However, the code is fine using
dev
.The code also is fine in prod if you visit the home page first before the page using Inview...
Here is an HTML difference from dev to prod:
Dev:
Prod direct:
Prod home then photos page:
It is not clear why visiting the photos page directly causes the
data-svelte-h="svelte-1ckqtup"
but I assume it must be an SSR issue. If anyone has a had this issue please let me know what I should try.