Skip to content

Commit

Permalink
Delete lodash library and add a TODO in SearcInput to add debounce fu…
Browse files Browse the repository at this point in the history
…nction to Collection
  • Loading branch information
anagperal committed Jun 28, 2024
1 parent 2106be7 commit 7f8ddf3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"d2": "31.10.2",
"d2-manifest": "1.0.0",
"font-awesome": "4.7.0",
"lodash": "^4.17.21",
"purify-ts": "1.2.0",
"purify-ts-extra-codec": "0.6.0",
"react": "^18.2.0",
Expand All @@ -50,7 +49,6 @@
"@testing-library/react": "^14.0.0",
"@types/classnames": "2.3.1",
"@types/isomorphic-fetch": "^0.0.36",
"@types/lodash": "^4.17.5",
"@types/material-ui": "^0.21.12",
"@types/node": "18",
"@types/node-localstorage": "^1.3.0",
Expand Down
9 changes: 4 additions & 5 deletions src/webapp/components/search-input/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useCallback, useEffect, useState } from "react";
import { TextField } from "@material-ui/core";
import { IconSearch24 } from "@dhis2/ui";
import styled from "styled-components";
import _ from "lodash";

import i18n from "../../../utils/i18n";

Expand All @@ -19,14 +18,14 @@ export const SearchInput: React.FC<SearchInputProps> = React.memo(

useEffect(() => updateStateValue(value), [value]);

// eslint-disable-next-line react-hooks/exhaustive-deps
// TODO: needs debounce function from Collection
const onChangeDebounced = useCallback(
_.debounce((value: string) => {
(value: string) => {
if (onChange) {
onChange(value);
}
}, 400),
[]
},
[onChange]
);

const handleChange = useCallback(
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4283,11 +4283,6 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==

"@types/lodash@^4.17.5":
version "4.17.5"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.5.tgz#e6c29b58e66995d57cd170ce3e2a61926d55ee04"
integrity sha512-MBIOHVZqVqgfro1euRDWX7OO0fBVUUMrN6Pwm8LQsz8cWhEpihlvR70ENj3f40j58TNxZaWv2ndSkInykNBBJw==

"@types/material-ui@^0.21.12":
version "0.21.12"
resolved "https://registry.yarnpkg.com/@types/material-ui/-/material-ui-0.21.12.tgz#208e8b7e49a545bb704fa7e865986afde1b33384"
Expand Down

0 comments on commit 7f8ddf3

Please sign in to comment.