Description
What's going on?
It came to my attention that I've introduced a Breaking change, without properly announcing it.
This is only related to iOS platform. Since version 1.0.2, location where Async Storage kept files was changed: 34fb665
Some time age, issue #40 was raised, saying that smooth transition from Core's Async Storage to Community's was not possible, as data was lost on migration (actually, stored somewhere else). I've merged a fix in #46, to bring back the compatibility.
Now, devs that already transitioned to this repo (pre v1.2.2), planning to upgrade to the latest (v1.2.2), would be left off with the same issue as before - their current local data would not be accessible again.
I can imagine how this can be frustrating, to see no breaking change note in the changelog, yet experiencing different module behavior than expected. If this is a case that you got into - I'm sorry, the blame is all mine.
What now?
I wanted to discuss a way to fix this issue, and give pre-v1.2.2 devs ability to upgrade to next versions, without breaking anything on the way.
To make this work, we need to move manifest.json
file from old (RNCAsyncLocalStorage_V1
) directory to a new, correct one (RCTAsyncLocalStorage_V1
), deleting unnecessary folder afterwards. This will ensure that data will be kept and in the right directory.
// pseudo native code
fun migrateToAsyncStorage() {
let oldDir = Dir('RNCAsyncLocalStorage_V1')
let newDir = Dir('RCTAsyncLocalStorage_V1')
if(oldDir.exists) {
moveManifest(oldDir, newDir);
deleteDir(oldDir);
}
}
This could be introduced as Native Module
or just a simple check on iOS side, when module is build.
Any feedback as always is appreciated, please let me know what you think.
thanks.