I am facing an issue with the code below, as the sessionstate does not seem to update properly. The initial result shows 3 social security numbers, but after attempting to update it with 100 new numbers, the count remains the same. Any insights on why this might be happening?
window.onbeforeunload = () => {
const ssnLs = $("#members-list-table")
.DataTable()
.rows({ filter: "applied" })
.data()
.map((item: any) => {
return item.socialSecurityNumber;
})
.toArray();
//added this line for testing - to see what value was here before I update
var localStorageWithMembersArray1 = JSON.parse(localStorage.getItem("socialnumbers"));
sessionStorage.setItem("socialnumbers", JSON.stringify(ssnLs));
//added this line for testing - to see what value is here after I update
var localStorageWithMembersArray = JSON.parse(localStorage.getItem("socialnumbers"));
};