medialize / medialize/jQuery-store
Initializing $.store twice adds duplicate en/decoders
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 70
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Running the following code:
```
s = new $.store();
s.set('test', {"a":1});
console.log('Get 1', s.get('test'));
s = new $.store();
console.log('Get 2', s.get('test'));
```
results in
```
Get 1 Object
a: 1
SyntaxError: Unexpected token o
```
This happens because .encoders and .decoders are part of the prototype, and thus globally modified every time `new $.store` is called.
This is an issue because I am using this in a single page application, and use it in just one model where it's needed (instead of storing a global reference and only initializing once).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the $.store constructor and inspect how the prototype-level .encoders and .decoders are initialized; reproduce the provided two-instance example first. Done means creating a second store does not duplicate registrations, and both get calls complete without the reported SyntaxError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100