Fix applicationStateModel serialization
This commit is contained in:
parent
d1881ae8fa
commit
aa15425dbc
5 changed files with 17 additions and 138 deletions
|
@ -9,7 +9,7 @@ onmessage = async(e) => {
|
|||
const request = {
|
||||
ApplicationState: state
|
||||
};
|
||||
const dataParsed = JSON.stringify(request, GetCircularReplacerKeepDataStructure());
|
||||
const dataParsed = JSON.stringify(request, GetCircularReplacer());
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: new Headers({
|
||||
|
@ -26,13 +26,25 @@ onmessage = async(e) => {
|
|||
});
|
||||
};
|
||||
|
||||
function GetCircularReplacerKeepDataStructure()
|
||||
function GetCircularReplacer()
|
||||
{
|
||||
return (key, value) => {
|
||||
if (key === 'parent') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (key === 'containers') {
|
||||
return Array.from(value.entries());
|
||||
}
|
||||
|
||||
if (key === 'symbols') {
|
||||
return Array.from(value.entries());
|
||||
}
|
||||
|
||||
if (key === 'linkedContainers') {
|
||||
return Array.from(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue