Skip to main content

Global storage returns same data though the key is different

  • September 7, 2023
  • 5 replies
  • 300 views

Forum|alt.badge.img

I am facing an issue while using global storage that the data is returning same though the key is different. Suppose if I store a value such as,
monday.storage.setItem(‘key#clientId#446487’, ‘some data’);

Where as while retrieving
monday.storage.getItem(‘key#clientId#446487’) ; // Returning ‘some data’
monday.storage.getItem(‘key#clientId#469720’) ; // Returning ‘some data’

Ideally it should return different data for the second statement as the key is different. Any idea? @rachelatmonday
I am not sure what is missing, Can you help me with this matter. Thanks

5 replies

dvdsmpsn
Forum|alt.badge.img+1
  • Participating Frequently
  • September 7, 2023

Try testing that with “_” or similar rather than “#” as your name separators. Just a guess.


Forum|alt.badge.img
  • Author
  • New Participant
  • September 7, 2023

Thanks @dvdsmpsn It is worked. But I do not understand why failing for ‘#’. And I do not see any specific instructions in the docs as well.


Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • September 7, 2023

Thank you @dvdsmpsn !

@RambabuPatina I will share this with our team so that we can take it into account to maybe add some notes in our documentation 😁

Cheers,
Matias


kolaai
Forum|alt.badge.img
  • monday.com Partner
  • September 7, 2023

I think this has to do with the currently the way the Storage API works. If you will still like to keep #, you can encode the key and then decode it when you want to use it.
The same principle applies to storing empty strings or new lines. They might save without any errors but if you try to get back those saved values, it will return a previously saved value


dvdsmpsn
Forum|alt.badge.img+1
  • Participating Frequently
  • September 7, 2023

Yeah, new lines. What a PITA. Find and replace before saving in storage 🤣