Skip to content

Provide warnings about resource interning #75

@multimeric

Description

@multimeric

I, foolishly, thought that the ID of the resources my JSON API server returns didn't matter. They were ephemeral resources, which didn't come from a database, so I thought I could just hard code a random string for their IDs.

However, I just spent an entire day trying to work out why, when I changed the query string that requested these resources, the resources didn't change. As it turns out, even though each API request returned different data, the client.find('my_resource') promise resolved to the old data. I only now realise that this is due to resource interning. I then changed my server to return data with unique IDs, and everything worked again.

I think a big warning message in the documentation saying make sure unique data has unique IDs would be helpful here, to save people like me experiencing this. I can't fault the fact that you do this, because the JSON API spec does require that all unique data has a unique ID.

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