fix: add check for when notifications is empty

This commit is contained in:
Jordan Knott
2021-11-04 10:55:34 -05:00
parent 799d7f3ad0
commit de6fe78004
9 changed files with 76 additions and 37 deletions

View File

@ -427,7 +427,7 @@ const NotificationPopup: React.FC = ({ children }) => {
onCompleted: (d) => {
setData((prev) => ({
hasNextPage: d.notified.pageInfo.hasNextPage,
cursor: d.notified.pageInfo.endCursor,
cursor: d.notified.pageInfo.endCursor ?? '',
nodes: [...prev.nodes, ...d.notified.notified],
}));
},
@ -482,7 +482,7 @@ const NotificationPopup: React.FC = ({ children }) => {
updateQuery: (prev, { fetchMoreResult }) => {
if (!fetchMoreResult) return prev;
setData((d) => ({
cursor: fetchMoreResult.notified.pageInfo.endCursor,
cursor: fetchMoreResult.notified.pageInfo.endCursor ?? '',
hasNextPage: fetchMoreResult.notified.pageInfo.hasNextPage,
nodes: [...d.nodes, ...fetchMoreResult.notified.notified],
}));

View File

@ -894,7 +894,7 @@ export type OwnersList = {
export type PageInfo = {
__typename?: 'PageInfo';
endCursor: Scalars['String'];
endCursor?: Maybe<Scalars['String']>;
hasNextPage: Scalars['Boolean'];
};