Skip to content

Commit

Permalink
Merge pull request #10936 from DestinyItemManager/use-use
Browse files Browse the repository at this point in the history
Switch from useContext to use
  • Loading branch information
bhollis authored Feb 7, 2025
2 parents 7c42fb3 + ae078a6 commit a183ff2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/app/loadout-analyzer/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { useLoadVendors } from 'app/vendors/hooks';
import {
ReactNode,
createContext,
use,
useCallback,
useContext,
useEffect,
useId,
useState,
Expand Down Expand Up @@ -99,7 +99,7 @@ export function MakeLoadoutAnalysisAvailable({ children }: { children: ReactNode
*/
export function useUpdateLoadoutAnalysisContext(storeId: string) {
const account = useSelector(currentAccountSelector)!;
const analyzer = useContext(LoadoutAnalyzerReactContext);
const analyzer = use(LoadoutAnalyzerReactContext);
const analysisContext = useSelector(autoOptimizationContextSelector(storeId));

useLoadVendors(account, storeId);
Expand All @@ -122,7 +122,7 @@ export function useAnalyzeLoadout(
}
| undefined {
const id = useId();
const analyzer = useContext(LoadoutAnalyzerReactContext);
const analyzer = use(LoadoutAnalyzerReactContext);
const subscribe = useCallback(
(callback: () => void) =>
active && analyzer
Expand All @@ -144,7 +144,7 @@ export function useSummaryLoadoutsAnalysis(
active: boolean,
): LoadoutAnalysisSummary | undefined {
const id = useId();
const analyzer = useContext(LoadoutAnalyzerReactContext);
const analyzer = use(LoadoutAnalyzerReactContext);
const subscribe = useCallback(
(callback: () => void) =>
active && analyzer
Expand Down
4 changes: 2 additions & 2 deletions src/app/vendors/VendorItemComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ItemPopupExtraInfo } from 'app/item-popup/item-popup';
import { DestinyCollectibleState } from 'bungie-api-ts/destiny2';
import clsx from 'clsx';
import { ItemCategoryHashes } from 'data/d2/generated-enums';
import React, { useContext } from 'react';
import React, { use } from 'react';
import BungieImage from '../dim-ui/BungieImage';
import ConnectedInventoryItem from '../inventory/ConnectedInventoryItem';
import ItemPopupTrigger from '../inventory/ItemPopupTrigger';
Expand All @@ -24,8 +24,8 @@ export default function VendorItemComponent({
owned: boolean;
characterId?: string;
}) {
const showVendor = useContext(SingleVendorSheetContext);
if (item.displayTile) {
const showVendor = use(SingleVendorSheetContext);
return (
<div className={styles.vendorItem}>
<a onClick={() => showVendor?.({ characterId, vendorHash: item.previewVendorHash })}>
Expand Down

0 comments on commit a183ff2

Please sign in to comment.