@@ -9,6 +9,7 @@ function AppContext ({ children }) {
99 window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches
1010 )
1111 const [ isLoading , setIsLoading ] = useState ( true )
12+ const [ isItemLoading , setIsItemLoading ] = useState ( true )
1213 const [ isError , setIsError ] = useState ( false )
1314 const [ isIssue , setIsIssue ] = useState ( false )
1415 const [ errorMessage , setErrorMessage ] = useState ( '' )
@@ -122,6 +123,7 @@ function AppContext ({ children }) {
122123 * @returns a list of suggested users
123124 */
124125 async function getUserSuggestions ( inputString ) {
126+ setIsItemLoading ( true )
125127 setIsError ( false )
126128 if ( ! inputString ) {
127129 setSuggestionList ( [ ] )
@@ -142,12 +144,14 @@ function AppContext ({ children }) {
142144 } catch ( error ) {
143145 setIsError ( true )
144146 }
147+ setIsItemLoading ( false )
145148 }
146149
147150 /**
148151 * Fetches more suggested items from subsequent pages of results
149152 */
150153 async function getMoreSuggestions ( ) {
154+ setIsItemLoading ( true )
151155 setIsError ( false )
152156 try {
153157 const response = await axios . get (
@@ -183,6 +187,7 @@ function AppContext ({ children }) {
183187 } catch ( error ) {
184188 setIsError ( true )
185189 }
190+ setIsItemLoading ( false )
186191 }
187192
188193 /**
@@ -248,6 +253,7 @@ function AppContext ({ children }) {
248253 < AppGlobalContext . Provider
249254 value = { {
250255 isLoading,
256+ isItemLoading,
251257 isError,
252258 isIssue,
253259 setIsError,
0 commit comments