Fixed behaviour of empty key prefix string #990
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
I recently stumpled upon the keyprefix-logic of localforage, when I explicitly didn't want to have a KeyPrefix in my LF instance. Avoiding to define an instance name, will lead to the issue that localforage itself sets the "localforage" prefix. Hence I did
This replaced the name field with an empty string, however e.g. the LocalStorage driver is still pre-prending a slash (/) to the keys I try to get. As it can be seen here:
localForage/src/drivers/localstorage.js
Line 14 in c1cc34f
I was wondering if this is a desired behaviour or not. For me it seems to be unwanted and thus I consider it being a bug. This PR will hopefully fix the issue.
I currently further maintain the ReactNative AsyncStorage Driver for LF as well as the WebExtension Storage Driver. If you also see this as a bug and accept the PR or similar I will also re-check these drivers for the same possible issue in these packages and fix if required.