sunt-programator / CodeIT

👩‍💻 A clean, elegant but advanced blog theme for Hugo
https://codeit.suntprogramator.dev
MIT License
103 stars 32 forks source link

[BUG] cloud not load the waline's comments #408

Open ryan4yin opened 2 years ago

ryan4yin commented 2 years ago

Describe the bug

when enable waline comment system, comments cannot been loaded, console shows the following error:

TypeError: Cannot read properties of null (reading 'insertBefore')
    at insert (Waline.min.js:1:65194)
    at z (Waline.min.js:1:44489)
    at C (Waline.min.js:1:43741)
    at w (Waline.min.js:1:43327)
    at ue.fn (Waline.min.js:1:49932)
    at ue.run (Waline.min.js:1:25553)
    at P (Waline.min.js:1:50224)
    at $ (Waline.min.js:1:48477)
    at j (Waline.min.js:1:46431)
    at w (Waline.min.js:1:43352)

But if I run waline with a timer delay, every thing will be ok:

                const config = {
                    el: '#waline',
                    serverURL: 'waline-comment.thiscute.world',
                    visitor: 'true',
                    dark: 'auto',
                };
                setTimeout(function() {
                    Waline(config);
                }, 300);

related issues:

I think it's because theme.js did something that would conflict with waline, such as edit the DOM elements, but I do not know how to solve this.

Expected behavior

no exceptions, comments works fine.

Build Environment

Additional Info

I test waline here: https://thiscute.world/about/