mondaycom / monday-sdk-js

Node.js and JavaScript SDK for developing over the monday.com platform
https://monday.com
MIT License
87 stars 39 forks source link

[Bug] monday.storage.instance.setItem not storing values between page reloads #90

Closed goodpilotfish closed 1 year ago

goodpilotfish commented 1 year ago

Describe the bug monday.storage does not remember setItems between page reloads

Steps to reproduce Working code

  1. Add follwing code (a setItem and a getItem)
    
    import mondaySdk from "monday-sdk-js";
    const monday = mondaySdk();
    const KEY = 'key';

monday.storage.instance.setItem(KEY, JSON.stringify({ tjo: 'tjo'})).then(res => { monday.storage.instance.getItem(KEY).then(res => { console.log(res.data.value); // -----> Correct { value: str, success: true } }); });

2. Comment out the setItem

monday.storage.instance.getItem(KEY).then(res => { console.log(res.data.value); });


4. Reload page --> // -----> Incorrect { value: null, success: true }

**Expected behavior**
Just like localStorage, getItem returns the right value after a page reload. Have I misunderstood anything? Here are the monday (docs)[https://developer.monday.com/apps/docs/mondaystorage]

**Context and environment**
Running the app inside the monday preview mode

**Additional information**
"monday-sdk-js": "^0.3.2"
goodpilotfish commented 1 year ago

I can verify that monday.storage started working when the app is Published (either as App or iFrame).

Proposed action:

yuhgto commented 1 year ago

Hey @goodpilotfish – thanks for reporting this. I can't reproduce it – I always get the correct value when reading from the storage, even without refreshing the page.

I tried setting the data and then retrieving it immediately. It worked.

I also tried commenting out one command at a time. It worked.

What kind of app feature did you test it on? I tried it on a board view and it worked fine.

EDIT: I tried it on all the feature types that support the storage API – board view, item view, widget, object view. For all of them, it worked as expected.

yuhgto commented 1 year ago

Heads up, I'm closing this issue. If you're still having trouble with this, please post in our dev community or shoot our technical support team an email so we can help you out!

Here are the links you need: