Forbid 'session' as sessionName in StoreSession.ts (Close #480) #704
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.
Related issue #480
My guess the reason of the issue is that
session
key is being used by store2 internally and it leads to unintended overrides: https://github.com/nbubna/store/blob/0216588bc53505e290c537aaae2c52fa5ad47df8/src/store2.js#L272The issue we're trying to solve is that when a user of gramjs is using the library for the first time, it's tempting to name the session folder
session
. However, doing so doesn't lead to persisting anything. The user may think the issue is related to his code or folder permissions. It's not obvious that the session name is the reason of the issue.To solve this, I suggest forbidding the use
session
as a name and throwing an exception instead. Another option could be to prefix the session name with something likegramjs_${sessionName}
, but I'm afraid it might cause a backward compatibility break.