MasonryInfiniteGrid columnSize on Svelte does not work on initial load, only on resize
See original GitHub issueI 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
- Use the official demo code: https://naver.github.io/egjs-infinitegrid/storybook/?path=/story/examples-masonryinfinitegrid--masonry-infinite-grid-template
- Click the
Svelte
tab, clickOpen Sandbox
- Note: The demo has a bug, fix
App.svelte
. Changefor (let i = i
tofor (let i = 0
- Add
columnSize={300}
to the component
Notice it does not render properly on initial load:
- Resize the window, notice it corrects the render:
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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?
@daybrush Thank you very much 😃
I have tried it, and my issue is resolved! Thank you for all your hard work!