jashkenas / jashkenas/backbone
Model.set does not call Model.parse, unlike Collection.set
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 28.1k
- Forks
- 5.3k
- PR merge metrics
- No merged PRs in 30d
Description
I stumble on a case where I did not understand why my model.set called with {parse: true} did not call the parse method. I was very surprise to discover that parse must be called manually before a model.set whereas an option {parse: true} is enough for Collection.
Why Collection automatically parse inside the set when option parse is true, whereas Model does the parse outside the set ? Model fetch/save/constructor do call the parse method with options.parse on true, set is really the only method with a weird behaviour. Is there a good reason?
Contributor guide
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 by reading the Model.set and Collection.set entry points and compare how each handles the parse option. Determine whether Model.set is intended to match Collection.set or retain its current contract, then verify the chosen behavior with focused tests for model parsing and collection parsing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100