summaryrefslogtreecommitdiffstats
path: root/frontend/components/Items.js
diff options
context:
space:
mode:
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>;