question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MasonryInfiniteGrid columnSize on Svelte does not work on initial load, only on resize

See original GitHub issue

I have not confirmed this behavior on any other frameworks, onlysvelte.

Description

On svelte, the MasonryInfiniteGrid does not seem to load properly upon initial render. But when resizing the window, the columns fall into place correctly.

This is using columnSize as described here: https://naver.github.io/egjs-infinitegrid/docs/api/MasonryInfiniteGridOptions (Also unrelated, the docs seem to have duplicates, isEqualSize for example is listed twice, along with others.)

Steps to check or reproduce

  1. Use the official demo code: https://naver.github.io/egjs-infinitegrid/storybook/?path=/story/examples-masonryinfinitegrid--masonry-infinite-grid-template
  2. Click the Svelte tab, click Open Sandbox
  3. Note: The demo has a bug, fix App.svelte. Change for (let i = i to for (let i = 0
  4. Add columnSize={300} to the component

Notice it does not render properly on initial load:

image

  1. Resize the window, notice it corrects the render:

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
franzvezulicommented, Jan 7, 2022

@daybrush Thanks. Adding a width to the demo code does fix that issue.

Setting a width on the top level element in my test app did not solve it however. I think it may have something to do with SSR? I’m assuming that the demos are using Svelte native, without SSR.

I noticed that during browser resize, the library ads this in-line styles:

style="position: absolute; top: 0px; left: 917px; width: 300px;"

Or something similar.

Are there any solutions for when using Sveltkit SSR?

0reactions
franzvezulicommented, Feb 26, 2022

@daybrush Thank you very much 😃

I have tried it, and my issue is resolved! Thank you for all your hard work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap + MasonryInfiniteGrid v4.2.0.beta.2 • REPL • ...
Note that first load has incorrect columns, but onRequestAppend, column size is correctly recalculated and the grid is restarted. Column size also correctly ......
Read more >
svelte remove this test • REPL • Svelte
Note that first load has incorrect columns, but onRequestAppend, column size is correctly recalculated and the grid is restarted. Column size also correctly ......
Read more >
Svelte Headless Table – Resize Bug • REPL • Svelte
const data = readable(createSamples(30));. 8. ​. 9. const table = createTable(data, {. 10. resize: addResizedColumns(),. 11. }); 12. 13. function read1() {.
Read more >
onMount Lifecycle Method - Window Resize • REPL • Svelte
return function () {. 10. const context = this;. 11. const args = arguments;. 12. clearTimeout(timer);. 13. timer = setTimeout(() => func.apply(context, ...
Read more >
Drag to resize • REPL • Svelte
<h1>Drag to resize</h1>. 9. ​. 10. <div class="timeline">. 11. <Event x={40}/>. 12. <Event x={10} width={80}/>. 13. </div>.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found