From dab8685e9d6cfc0dba2f9cc690c6f1dfdc0467db Mon Sep 17 00:00:00 2001 From: Akuoko Daniel Jnr Date: Tue, 30 Mar 2021 18:08:21 +0000 Subject: [PATCH] fix: fetch suggestions --- components/core/CarouselSidebarData.js | 9 +++++++-- components/core/CarouselSidebarSlate.js | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/components/core/CarouselSidebarData.js b/components/core/CarouselSidebarData.js index fcb12264..628d8b21 100644 --- a/components/core/CarouselSidebarData.js +++ b/components/core/CarouselSidebarData.js @@ -299,8 +299,13 @@ class CarouselSidebarData extends React.Component { }; updateSuggestions = () => { - let newSuggestions = new Set([...this.props.viewer.tags, ...this.state.tags]); - this.setState({ suggestions: Array.from(newSuggestions) }); + if (Array.isArray(this.props.viewer.tags)) { + let newSuggestions = new Set([...this.props.viewer.tags, ...this.state.tags]); + this.setState({ suggestions: Array.from(newSuggestions) }); + return; + } + + this.setState({ suggestions: this.state.tag }); }; _handleDarkMode = async (e) => { diff --git a/components/core/CarouselSidebarSlate.js b/components/core/CarouselSidebarSlate.js index 556783bd..541cca54 100644 --- a/components/core/CarouselSidebarSlate.js +++ b/components/core/CarouselSidebarSlate.js @@ -231,8 +231,13 @@ export default class CarouselSidebarSlate extends React.Component { }; updateSuggestions = () => { - let newSuggestions = new Set([...this.props.viewer.tags, ...this.state.tags]); - this.setState({ suggestions: Array.from(newSuggestions) }); + if (Array.isArray(this.props.viewer.tags)) { + let newSuggestions = new Set([...this.props.viewer.tags, ...this.state.tags]); + this.setState({ suggestions: Array.from(newSuggestions) }); + return; + } + + this.setState({ suggestions: this.state.tag }); }; _handleClose = () => {