facebook / facebook/relay

Bulk insert into store

Open
#2,247 9 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

# The Problem:

We are attempting to add local data to the store because we keep a local schema that allows us to have client only fields. We have been using `commitLocalUpdate` calls whenever we wanted to change some client only fields. We came across a case where we want to update a bunch of data, and not just a field at a time. When using the store API from something like `commitLocalUpdate` I would like to have the ability to set a query response to the store with the same ease of creating an `optimisticResponse`

# My thoughts so far:

My first thought was that I could just do a regular mutation and intercept it in the network layer. This seems hacky.

Next, I thought, okay, how about giving commitLocalUpdate the same interface as normal mutations. This seems like forcing a square peg in a round hole.

Now I'm thinking, maybe there should be some kind of bulk insert API for the store. It would make the imperative store API so much more accessible to us mortals.

I would love to talk this through and would be happy to provide a pull request. I know how important encouraging the right usage of the framework is, so I would be happy to discuss the implications of this also.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.