jashkenas / jashkenas/backbone

Model.set does not call Model.parse, unlike Collection.set

Open
#4,038 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

break quality
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.