Blank page when creating a table with tuples as values
Closed this issue · 2 comments
Hey, I'm using Nim 1.4.0 and Karax 1.2.1 and I have some very strange behavior, which I suspect to be a bug.
When I try the following code:
include karax / prelude
proc createDom(): VNode =
buildHtml(tdiv):
text "Hello World"
setRenderer createDom
I see the "Hello World" as expected (at least after modifying the html that is generated by karun so that it points to "app.js" instead of "/app.js" and opening the html file in the Browser. If I just use karun I'll only see a white page)
After then modifying the code to look like this:
include karax / prelude
import tables
let tab = toTable {"foo": (1, 2)}
proc createDom(): VNode =
buildHtml(tdiv):
text "Hello World"
setRenderer createDom
I'll only see a white page again. The problem seems to be a table where the key-type is a tuple of ints. If you create a table with string values everything continues to work. I compile via "nim js -o:app.js foo.nim" to prevent my modified html from getting overwritten
Can confirm.
Here is a sample browser err msg:
app.js:1065 Uncaught TypeError: src_1470024.slice is not a function
at nimCopy (app.js:1065)
at nimCopyAux (app.js:6041)
at nimCopyAux (app.js:6046)
at nimCopy (app.js:1040)
at toTable_12811022 (app.js:6658)
at app.js:6674
nimCopy @ app.js:1065
nimCopyAux @ app.js:6041
nimCopyAux @ app.js:6046
nimCopy @ app.js:1040
toTable_12811022 @ app.js:6658
(anonymous) @ app.js:6674
This isn't actually a Karax issue, but is instead a Nim JS backend issue. I tested with Nim 1.4.4 and was able to reproduce, however the error goes away on Nim devel. Closing for now, if there are further issues that you find, probably want to reopen at https://github.com/nim-lang/Nim/issues if you can reproduce it without Karax
Version of the compiler that doesn't have the issue:
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-04-14
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: fe77c3c72fe1fde4f41286158ba612c02083dfe2
active boot switches: -d:release