You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we return data of type new Map() from corresponding page endpoints, the component getting rendered in browser is unable to get the data, while server side is able to get it correctly.
Reproduction
index.svelte
<script>
export let initialData;
let map = initialData.map;
console.log('in index.svelte map', map);
</script>
index.js
export async function get({ params }) {
let map = new Map();
map.set("key", "value");
let initialData = { "map": map }
return {
body: {
initialData
}
};
};
Below is what we see, as you can see on server side it shows map values {'key' : 'value'}, but on the browser its empty.
Moreoever, the data type itself is changed, on server its still Map, but on browser its changed to dictionary ({}).
But if we change the type to diction in index.js as follows
export async function get({ params }) {
let map = {};
map["key"] = "value";
let initialData = { "map": map }
return {
body: {
initialData
}
}
}
then both server and browser gets the data correctly as shown below.
Describe the bug
If we return data of type new Map() from corresponding page endpoints, the component getting rendered in browser is unable to get the data, while server side is able to get it correctly.
Reproduction
index.svelte
index.js
Below is what we see, as you can see on server side it shows map values {'key' : 'value'}, but on the browser its empty.
Moreoever, the data type itself is changed, on server its still Map, but on browser its changed to dictionary ({}).
But if we change the type to diction in index.js as follows
then both server and browser gets the data correctly as shown below.
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: