Skip to content

Commit

Permalink
Use useCallback for url
Browse files Browse the repository at this point in the history
  • Loading branch information
romeovs committed Oct 15, 2024
1 parent 062b254 commit f7f637c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Tool, useProjectId} from 'sanity'
import {useCallback} from 'react'

import 'graphiql/graphiql.css'
import './custom.css'
Expand Down Expand Up @@ -45,12 +46,12 @@ function Render(props: GraphiQLToolProps) {
})
const storage = useNamespacedStorage<State>(state, setState)

function setUrl(url: string) {
const setUrl = useCallback(function (url: string) {
setState((state) => ({
...state,
url,
}))
}
}, [])

if (apis.data?.length === 0) {
return (
Expand Down

0 comments on commit f7f637c

Please sign in to comment.