# wix-storage bugginess across different page code

**URL:** <https://forum.wixstudio.com/t/wix-storage-bugginess-across-different-page-code/10084>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [March 4, 2021, 4:57am UTC](https://forum.wixstudio.com/t/wix-storage-bugginess-across-different-page-code/10084 "2021-03-04T04:57:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattdietsche](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mattdietsche/32/8368_2.png) [@mattdietsche](https://forum.wixstudio.com/u/mattdietsche)\
**Post date:** [March 4, 2021, 4:57am UTC](https://forum.wixstudio.com/t/wix-storage-bugginess-across-different-page-code/10084/1 "2021-03-04T04:57:13Z")

</div>

I have 2 different pages each containing a custom HTML element. One of the pages is a lightbox. Both HTML elements have different UI and code that sends data back to the parent window using postMessage. Then there is page code for each page that listens for the messages from custom html element and sets the data into local storage using the same key. The code for getting and updating the data in local storage is all done in a public JS file using wix-storage, so it’s available to page code on any page.

Everything works fine except that it seems like each page is dealing with a different instance of the local storage object. local.getItem() is returning different things depending upon what page code it’s called from.

Here’s some code from the public JS file handling the local storage:

**const** localStorageKey = ‘itemList-v1’ ;

export const getList = () =\> {  
**const** list = JSON.parse(local.getItem(localStorageKey) || ‘’ );  
console.log( ‘getItem’ , list);  
**return** list;  
};

export const addToList = item =\> {  
**const** list = getList();  
list.push(item);  
console.log( ‘setItem’ , list);  
local.setItem(localStorageKey, JSON.stringify(list));  
**return** list;  
};
