Skip to content

[chapter 5] fix User inPhotos logic #51

@dorakemon

Description

@dorakemon

I read Japanese edition and found a mistake that is not related to a main topic

The below code is written in a book

    inPhotos: (parent: any) =>
      tags
        .filter((tag) => tag.userID === parent.id)
        .map((tag) => tag.photoID)
        .map((photoID) => photos.find((p) => p.id === photoID))

However correct code is below

    inPhotos: (parent: any) =>
      tags
        // NOT parent.id BUT parent.githubLogin
        .filter((tag) => tag.userID === parent.githubLogin)
        .map((tag) => tag.photoID)
        .map((photoID) => photos.find((p) => p.id === photoID))

tag.userID is githubLogin ("gPlake") NOT id ("1")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions