summaryrefslogtreecommitdiffstats
path: root/frontend/components/Items.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-04-06 10:26:55 -0400
committerWes Bos <wesbos@gmail.com>2018-04-06 10:26:55 -0400
commitd90d97337c39e1fa723ee01627fbd3f78adfcf31 (patch)
tree88c4aed1e89d52bece431549aca0995b776d4f53 /frontend/components/Items.js
parentc360126540e65a7a919f0bf73602ecd3c9ed806b (diff)
weeeeeee
Diffstat (limited to 'frontend/components/Items.js')
-rw-r--r--frontend/components/Items.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/frontend/components/Items.js b/frontend/components/Items.js
index 6a5defa..3c28de2 100644
--- a/frontend/components/Items.js
+++ b/frontend/components/Items.js
@@ -23,7 +23,17 @@ class ItemList extends React.Component {
static propTypes = {
page: PropTypes.number.isRequired,
};
+ static getDerivedStateFromProps(nextProps, state) {
+ console.log(nextProps);
+ return { refetch: state.page !== nextProps.page };
+ }
+ state = {
+ refetch: false,
+ };
render() {
+ const fetchPolicy = this.state.refetch ? 'network-only' : 'cache-first';
+ console.log(this.state.refetch, this.props.page);
+ console.log(fetchPolicy);
return (
<Center key={this.props.page}>
<Pagination page={this.props.page} />
@@ -33,6 +43,7 @@ class ItemList extends React.Component {
skip: this.props.page * perPage - perPage,
first: perPage,
}}
+ fetchPolicy={fetchPolicy}
>
{({ data, error, loading }) => {
if (loading) return <div>Loading</div>;