Skip to content

Commit

Permalink
Deploy website
Browse files Browse the repository at this point in the history
Deploy website version based on e2e4af5
  • Loading branch information
relay-bot committed Apr 3, 2020
1 parent 186ea7c commit badbe55
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 14 deletions.
1 change: 1 addition & 0 deletions CNAME
@@ -0,0 +1 @@
relay.dev
34 changes: 27 additions & 7 deletions docs/en/next/local-state-management.html
Expand Up @@ -164,12 +164,32 @@ <h3><a class="anchor" aria-hidden="true" id="create"></a><a href="#create" aria-
</code></pre>
<p>Note that since this record will be rendered by the <code>ExampleQuery</code> in our <code>QueryRenderer</code>, the QueryRenderer will automatically retain this data so it isn't garbage collected.</p>
<p>If no component is rendering the local data and you want to manually retain it, you can do so by calling <code>environment.retain()</code>:</p>
<pre><code class="hljs css language-javascript"><span class="hljs-comment">// Tell Relay to retain the record so it isn't garbage collected</span>
environment.retain({
dataID,
<span class="hljs-attr">variables</span>: {},
<span class="hljs-attr">node</span>: { <span class="hljs-attr">selections</span>: [] }
});
<pre><code class="hljs css language-javascript"><span class="hljs-keyword">import</span> {createOperationDescriptor, getRequest} <span class="hljs-keyword">from</span> <span class="hljs-string">'relay-runtime'</span>;

<span class="hljs-comment">// Create a query that references that record</span>
<span class="hljs-keyword">const</span> localDataQuery = graphql<span class="hljs-string">`
query LocalDataQuery {
viewer {
notes {
__typename
}
}
}
`</span>;

<span class="hljs-comment">// Create an operation descriptor for the query</span>
<span class="hljs-keyword">const</span> request = getRequest(localDataQuery);
<span class="hljs-keyword">const</span> operation = createOperationDescriptor(request, {} <span class="hljs-comment">/* variables */</span>);


<span class="hljs-comment">// Tell Relay to retain this operation so any data referenced by it isn't garbage collected</span>
<span class="hljs-comment">// In this case, all the notes linked to the `viewer` will be retained</span>
<span class="hljs-keyword">const</span> disposable = environment.retain(operation);


<span class="hljs-comment">// Whenever you don't need that data anymore and it's okay for Relay to garbage collect it,</span>
<span class="hljs-comment">// you can dispose of the retain</span>
disposable.dispose();
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="update"></a><a href="#update" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Update</h3>
<pre><code class="hljs css language-javascript"><span class="hljs-keyword">import</span> {commitLocalUpdate} <span class="hljs-keyword">from</span> <span class="hljs-string">'react-relay'</span>;
Expand Down Expand Up @@ -214,7 +234,7 @@ <h2><a class="anchor" aria-hidden="true" id="initial-local-state"></a><a href="#
user.setLinkedRecords([], <span class="hljs-string">'notes'</span>);
});
</code></pre>
</span></div></article></div><div class="docLastUpdate"><em>Last updated on 11/2/2019 by Baptist BENOIST</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/en/next/testing-relay-components"><span class="arrow-prev"></span><span>Testing Relay Components</span></a><a class="docs-next button" href="/docs/en/next/thinking-in-graphql"><span class="function-name-prevnext">Thinking in GraphQL</span><span class="arrow-next"></span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#extending-the-server-schema">Extending the server schema</a></li><li><a href="#querying-local-state">Querying local state</a></li><li><a href="#mutating-local-state">Mutating local state</a><ul class="toc-headings"><li><a href="#create">Create</a></li><li><a href="#update">Update</a></li><li><a href="#delete">Delete</a></li></ul></li><li><a href="#initial-local-state">Initial local state</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/relay.svg" alt="Relay" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/en/introduction-to-relay.html">Introduction</a></div><div><h5>Community</h5><a href="/en/users.html">User Showcase</a></div><div><h5>More</h5><a href="https://github.com/facebook/relay">GitHub</a><a class="github-button" href="https://github.com/facebook/relay" data-icon="octicon-star" data-count-href="/facebook/relay/stargazers" data-count-api="/repos/facebook/relay#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star this project on GitHub">Star</a></div></section><a href="https://code.facebook.com/projects/" target="_blank" class="fbOpenSource"><img src="/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright">Copyright © 2020 Facebook Inc.</section></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>
</span></div></article></div><div class="docLastUpdate"><em>Last updated on 3/25/2020 by Juan Tejada</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/en/next/testing-relay-components"><span class="arrow-prev"></span><span>Testing Relay Components</span></a><a class="docs-next button" href="/docs/en/next/thinking-in-graphql"><span class="function-name-prevnext">Thinking in GraphQL</span><span class="arrow-next"></span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#extending-the-server-schema">Extending the server schema</a></li><li><a href="#querying-local-state">Querying local state</a></li><li><a href="#mutating-local-state">Mutating local state</a><ul class="toc-headings"><li><a href="#create">Create</a></li><li><a href="#update">Update</a></li><li><a href="#delete">Delete</a></li></ul></li><li><a href="#initial-local-state">Initial local state</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/relay.svg" alt="Relay" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/en/introduction-to-relay.html">Introduction</a></div><div><h5>Community</h5><a href="/en/users.html">User Showcase</a></div><div><h5>More</h5><a href="https://github.com/facebook/relay">GitHub</a><a class="github-button" href="https://github.com/facebook/relay" data-icon="octicon-star" data-count-href="/facebook/relay/stargazers" data-count-api="/repos/facebook/relay#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star this project on GitHub">Star</a></div></section><a href="https://code.facebook.com/projects/" target="_blank" class="fbOpenSource"><img src="/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright">Copyright © 2020 Facebook Inc.</section></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>
document.addEventListener('keyup', function(e) {
if (e.target !== document.body) {
return;
Expand Down
34 changes: 27 additions & 7 deletions docs/en/next/local-state-management/index.html
Expand Up @@ -164,12 +164,32 @@ <h3><a class="anchor" aria-hidden="true" id="create"></a><a href="#create" aria-
</code></pre>
<p>Note that since this record will be rendered by the <code>ExampleQuery</code> in our <code>QueryRenderer</code>, the QueryRenderer will automatically retain this data so it isn't garbage collected.</p>
<p>If no component is rendering the local data and you want to manually retain it, you can do so by calling <code>environment.retain()</code>:</p>
<pre><code class="hljs css language-javascript"><span class="hljs-comment">// Tell Relay to retain the record so it isn't garbage collected</span>
environment.retain({
dataID,
<span class="hljs-attr">variables</span>: {},
<span class="hljs-attr">node</span>: { <span class="hljs-attr">selections</span>: [] }
});
<pre><code class="hljs css language-javascript"><span class="hljs-keyword">import</span> {createOperationDescriptor, getRequest} <span class="hljs-keyword">from</span> <span class="hljs-string">'relay-runtime'</span>;

<span class="hljs-comment">// Create a query that references that record</span>
<span class="hljs-keyword">const</span> localDataQuery = graphql<span class="hljs-string">`
query LocalDataQuery {
viewer {
notes {
__typename
}
}
}
`</span>;

<span class="hljs-comment">// Create an operation descriptor for the query</span>
<span class="hljs-keyword">const</span> request = getRequest(localDataQuery);
<span class="hljs-keyword">const</span> operation = createOperationDescriptor(request, {} <span class="hljs-comment">/* variables */</span>);


<span class="hljs-comment">// Tell Relay to retain this operation so any data referenced by it isn't garbage collected</span>
<span class="hljs-comment">// In this case, all the notes linked to the `viewer` will be retained</span>
<span class="hljs-keyword">const</span> disposable = environment.retain(operation);


<span class="hljs-comment">// Whenever you don't need that data anymore and it's okay for Relay to garbage collect it,</span>
<span class="hljs-comment">// you can dispose of the retain</span>
disposable.dispose();
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="update"></a><a href="#update" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Update</h3>
<pre><code class="hljs css language-javascript"><span class="hljs-keyword">import</span> {commitLocalUpdate} <span class="hljs-keyword">from</span> <span class="hljs-string">'react-relay'</span>;
Expand Down Expand Up @@ -214,7 +234,7 @@ <h2><a class="anchor" aria-hidden="true" id="initial-local-state"></a><a href="#
user.setLinkedRecords([], <span class="hljs-string">'notes'</span>);
});
</code></pre>
</span></div></article></div><div class="docLastUpdate"><em>Last updated on 11/2/2019 by Baptist BENOIST</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/en/next/testing-relay-components"><span class="arrow-prev"></span><span>Testing Relay Components</span></a><a class="docs-next button" href="/docs/en/next/thinking-in-graphql"><span class="function-name-prevnext">Thinking in GraphQL</span><span class="arrow-next"></span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#extending-the-server-schema">Extending the server schema</a></li><li><a href="#querying-local-state">Querying local state</a></li><li><a href="#mutating-local-state">Mutating local state</a><ul class="toc-headings"><li><a href="#create">Create</a></li><li><a href="#update">Update</a></li><li><a href="#delete">Delete</a></li></ul></li><li><a href="#initial-local-state">Initial local state</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/relay.svg" alt="Relay" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/en/introduction-to-relay.html">Introduction</a></div><div><h5>Community</h5><a href="/en/users.html">User Showcase</a></div><div><h5>More</h5><a href="https://github.com/facebook/relay">GitHub</a><a class="github-button" href="https://github.com/facebook/relay" data-icon="octicon-star" data-count-href="/facebook/relay/stargazers" data-count-api="/repos/facebook/relay#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star this project on GitHub">Star</a></div></section><a href="https://code.facebook.com/projects/" target="_blank" class="fbOpenSource"><img src="/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright">Copyright © 2020 Facebook Inc.</section></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>
</span></div></article></div><div class="docLastUpdate"><em>Last updated on 3/25/2020 by Juan Tejada</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/en/next/testing-relay-components"><span class="arrow-prev"></span><span>Testing Relay Components</span></a><a class="docs-next button" href="/docs/en/next/thinking-in-graphql"><span class="function-name-prevnext">Thinking in GraphQL</span><span class="arrow-next"></span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#extending-the-server-schema">Extending the server schema</a></li><li><a href="#querying-local-state">Querying local state</a></li><li><a href="#mutating-local-state">Mutating local state</a><ul class="toc-headings"><li><a href="#create">Create</a></li><li><a href="#update">Update</a></li><li><a href="#delete">Delete</a></li></ul></li><li><a href="#initial-local-state">Initial local state</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/relay.svg" alt="Relay" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/en/introduction-to-relay.html">Introduction</a></div><div><h5>Community</h5><a href="/en/users.html">User Showcase</a></div><div><h5>More</h5><a href="https://github.com/facebook/relay">GitHub</a><a class="github-button" href="https://github.com/facebook/relay" data-icon="octicon-star" data-count-href="/facebook/relay/stargazers" data-count-api="/repos/facebook/relay#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star this project on GitHub">Star</a></div></section><a href="https://code.facebook.com/projects/" target="_blank" class="fbOpenSource"><img src="/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright">Copyright © 2020 Facebook Inc.</section></footer></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>
document.addEventListener('keyup', function(e) {
if (e.target !== document.body) {
return;
Expand Down

0 comments on commit badbe55

Please sign in to comment.