Skip to content

Examples do not correctly useCallback and useEffect #6615

@alex-page

Description

@alex-page
/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/account-connection.tsx
  11:6  warning  React Hook useCallback has an unnecessary dependency: 'connected'. Either exclude it or remove the dependency array  react-hooks/exhaustive-deps

/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/account-connection.tsx
  11:6  warning  React Hook useCallback has an unnecessary dependency: 'connected'. Either exclude it or remove the dependency array  react-hooks/exhaustive-deps

/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/autocomplete-basic.tsx
  7:9  warning  The 'deselectedOptions' array makes the dependencies of useCallback Hook (at line 33) change on every render. To fix this, wrap the initialization of 'deselectedOptions' in its own useMemo() Hook  react-hooks/exhaustive-deps

/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/autocomplete-multiple-tags.tsx
  6:9  warning  The 'deselectedOptions' array makes the dependencies of useCallback Hook (at line 36) change on every render. To fix this, wrap the initialization of 'deselectedOptions' in its own useMemo() Hook  react-hooks/exhaustive-deps

/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/autocomplete-with-action.tsx
  7:9  warning  The 'deselectedOptions' array makes the dependencies of useCallback Hook (at line 41) change on every render. To fix this, wrap the initialization of 'deselectedOptions' in its own useMemo() Hook  react-hooks/exhaustive-deps

/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/autocomplete-with-destructive-action.tsx
  7:9  warning  The 'deselectedOptions' array makes the dependencies of useCallback Hook (at line 41) change on every render. To fix this, wrap the initialization of 'deselectedOptions' in its own useMemo() Hook  react-hooks/exhaustive-deps

/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/autocomplete-with-empty-state.tsx
  41:5  warning  React Hook useCallback has an unnecessary dependency: 'options'. Either exclude it or remove the dependency array  react-hooks/exhaustive-deps

/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/autocomplete-with-lazy-loading.tsx
  71:5  warning  React Hook useCallback has an unnecessary dependency: 'options'. Either exclude it or remove the dependency array  react-hooks/exhaustive-deps

/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/autocomplete-with-loading.tsx
  41:5  warning  React Hook useCallback has an unnecessary dependency: 'options'. Either exclude it or remove the dependency array  react-hooks/exhaustive-deps

/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/autocomplete-with-wrapping-action.tsx
  7:9  warning  The 'deselectedOptions' array makes the dependencies of useCallback Hook (at line 41) change on every render. To fix this, wrap the initialization of 'deselectedOptions' in its own useMemo() Hook  react-hooks/exhaustive-deps

/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/combobox-multi-select-autocomplete.tsx
  63:5  warning  React Hook useCallback has a missing dependency: 'updateText'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
  
/Users/alexpage/Sites/shopify/polaris/polaris.shopify.com/src/pages/examples/text-field-with-inline-suggestion.tsx
  75:6  warning  React Hook useCallback has a missing dependency: 'suggestions'. Either include it or remove the dependency array                        react-hooks/exhaustive-deps
  79:6  warning  React Hook useEffect has missing dependencies: 'handleSuggestion' and 'suggestion'. Either include them or remove the dependency array  react-hooks/exhaustive-deps

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions