Skip to content

Commit

Permalink
Merge pull request #1936 from KevinTCoughlin/user/keco/functional-asy…
Browse files Browse the repository at this point in the history
…nc-dispose

Dispose of Async instance to prevent memory leak
  • Loading branch information
AJIXuMuK authored Mar 3, 2025
2 parents 739c4d5 + aa321c4 commit 91a4b7b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/controls/sitePicker/SitePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import {
SelectableOptionMenuItemType,
Icon
} from '@fluentui/react';

import { Async } from '@uifabric/utilities/lib/Async';
import { useAsync } from '@fluentui/react-hooks';

import * as telemetry from '../../common/telemetry';
import { toRelativeUrl } from '../../common/utilities/GeneralHelper';
Expand Down Expand Up @@ -67,8 +66,6 @@ const styles = mergeStyleSets({
},
});

const async = new Async();

export const SitePicker: React.FunctionComponent<ISitePickerProps> = (
props: React.PropsWithChildren<ISitePickerProps>
) => {
Expand Down Expand Up @@ -99,6 +96,7 @@ export const SitePicker: React.FunctionComponent<ISitePickerProps> = (
const [allSites, setAllSites] = React.useState<ISite[]>();
const [filteredSites, setFilteredSites] = React.useState<ISite[]>();
const [searchQuery, setSearchQuery] = React.useState<string>();
const async = useAsync();

const onSearchChange = React.useCallback(
(e, newSearchQuery: string) => {
Expand Down

0 comments on commit 91a4b7b

Please sign in to comment.