"localStorage" and "sessionStorage" will not ship to the public in October

Hi Everyone,

Two APIs made it into the recent build that we will be removing before the public launch: localStorage and sessionStorage While these APIs were undocumented, we believe some plugins may be using them anyway, so we want to alert you asap.

Reasons

It is important to remove any calls to these APIs from your code as soon as possible for a couple of reasons.

First, the APIs will not ship to the public in October. Second, there are issues with their current implementation that may cause XD to crash.

Workaround

The workaround is to use the “plugin data folder” location to store a JSON file on disk. The “plugin data folder” is the result of the Promise returned by:

require("uxp").storage.localFileSystem.getDataFolder()

localStorage is also using JSON, so it shouldn’t be a major change. Be sure to manually flush preferences data to disk at the right times.

1 Like

Hello! Are there any updates on that? localStorage still seems to be not available.

@gdreyv localStorage is not likely going to be supported going forward. You can save information in the temporary folder instead.

const folder = require("uxp").storage.localFileSystem.getTemporaryFolder();

Do you have any use case that can’t use this as a workaround? Please let us know.

1 Like

Hey @stevekwak.

In my case, I don’t mind to turn off a specific feature in my plugin that leverages localStorage, so my only concern is the mentioned XD crash. Would a try catch wrapper prevent XD from crashing?
Else, any information on the XD versions that may experience a crash?