gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source.
https://gno.land/
Other
882 stars 367 forks source link

javascript: getElementById("source") not always available #2564

Open grepsuzette opened 2 months ago

grepsuzette commented 2 months ago

How to reproduce this bug

doc

The cause is shown here: doc2

#source is only produced by a few templates: views/generic.html (not sure if it's used however) and views/realm_render.html.

Suggested solution

In https://github.com/gnolang/gno/blob/6432573d82e03cce4c1607b1d37e274ad36bd935/gno.land/pkg/gnoweb/views/funcs.html#L161-L177

Immediately after main() insert a line if (document.getElementById("source") == null) return false;

Posting a fix right now.

thehowl commented 11 hours ago

If somebody wants to fix it, check out my comments on #2565: https://github.com/gnolang/gno/pull/2565#issuecomment-2250437482

Or wait for when we re-organize gnoweb, Soon:tm: .