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
+5 -2
View File
@@ -165,8 +165,11 @@ options[OptionsType.ATTR] = (name, value) => {
const PATCHED = new WeakSet<VNode>();
function normalizeKey(str: string) {
return str.replaceAll(":", "_");
function normalizeKey(key: string | number) {
if (typeof key === "number") {
key = key.toString();
}
return key.replaceAll(":", "_");
}
const oldDiff = options[OptionsType.DIFF];