fix: support numeric keys when rendering (#2584)

I'm trying to migrate one of my projects which publishes a plugin, and
this was blocking me.

Looks like key is typed as `export type Key = string | number | any;`,
so we might need to make more changes here in the future.
This commit is contained in:
Reed von Redwitz
2024-07-07 19:09:11 +02:00
committed by GitHub
parent 364810def4
commit 8413666786
2 changed files with 27 additions and 2 deletions
+22
View File
@@ -1150,3 +1150,25 @@ Deno.test("fsRoutes - default GET route doesn't override existing handler", asyn
"<h1>true</h1>",
);
});
Deno.test("support numeric keys", async () => {
const TestComponent = () => <div>foo</div>;
const server = await createServer({
"routes/index.tsx": {
default: () => {
return (
<>
<TestComponent key={0} />
<TestComponent key={1} />
ok
</>
);
},
},
});
const res = await server.get("/");
const text = await res.text();
expect(text).toContain("ok");
});