CentreForDigitalHumanities / CentreForDigitalHumanities/backbone-collection-transformers

FilteredCollection should copy modelId method from underlying collection, but doesn't

Open Beginner friendly
#2 0 comments 0 reactions 0 assignees View on GitHub
bug good first issue
Dominant language
JavaScript
Stars
0
Forks
2
PR merge metrics
No merged PRs in 30d

Description

An underlying collection might, for whatever reason, have multiple models with identical `id`s. This is fine, if the underlying collection has an overridden `modelId` method that distinguishes between those models.

FilteredCollection falls back to the default `modelId`. Hence, if two models in the underlying collection both pass the filter criterion and also have identical `id`s, then they should be both present in the filtered collection, but only one will actually be retained.

Solution: in the FilteredCollection constructor, copy the `modelId` method from the underlying collection.

Contributor guide

Open the contributing guide

Research direction

Start at the FilteredCollection constructor and compare its modelId behavior with the underlying collection. Verify that a filtered collection preserves the underlying collection's modelId behavior and retains both matching models with identical ids.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.