e2corporation commented on code in PR #2928:
URL: https://github.com/apache/incubator-devlake/pull/2928#discussion_r962710907
##########
config-ui/src/hooks/useConnectionManager.jsx:
##########
@@ -42,15 +43,13 @@ function useConnectionManager (
const [provider, setProvider] = useState(activeProvider)
const [name, setName] = useState()
+ // @todo: refactor to endpoint and setEndpoint
const [endpointUrl, setEndpointUrl] = useState()
const [proxy, setProxy] = useState()
- const [rateLimit, setRateLimit] = useState(0)
+ const [rateLimitPerHour, setRateLimitPerHour] = useState(0)
const [token, setToken] = useState()
- const [initialTokenStore, setInitialTokenStore] = useState({
- 0: '',
- 1: '',
- 2: ''
- })
+ const defaultTokenStore = useMemo(() => ({ 0: '', 1: '', 2: '' }), [])
+ const [initialTokenStore, setInitialTokenStore] = useState(defaultTokenStore)
Review Comment:
Because the default tokenStore is reused in several places why would I want
to re-create a generic object each time when I can create a default token store
instead? Please read the code before making baseless comments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]