-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DoDontBlock): performance improvement (#781)
* feat(DoDontBlock): performance improvement * fix tests * conditionally request assets * fix review comments * fix review comments
- Loading branch information
1 parent
5e588f9
commit b3fb348
Showing
14 changed files
with
563 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,9 @@ | |
"pnpm": { | ||
"overrides": { | ||
"@codesandbox/sandpack-react@^2.12.1>@codesandbox/sandpack-client": "2.10.0" | ||
}, | ||
"patchedDependencies": { | ||
"@udecode/[email protected]": "patches/@[email protected]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* (c) Copyright Frontify Ltd., all rights reserved. */ | ||
|
||
import { AppBridgeBlock, Asset, useBlockAssets } from '@frontify/app-bridge'; | ||
import { ReactNode, createContext } from 'react'; | ||
|
||
type AssetsProviderProps = { | ||
appBridge: AppBridgeBlock; | ||
children: ReactNode; | ||
}; | ||
|
||
type AssetsContext = { | ||
blockAssets?: Record<string, Asset[]>; | ||
addAssetIdsToKey?: (key: string, assetIds: number[]) => Promise<void>; | ||
deleteAssetIdsFromKey?: (key: string, assetIds: number[]) => Promise<void>; | ||
}; | ||
|
||
export const AssetsContext = createContext<AssetsContext>({} as AssetsContext); | ||
|
||
export const AssetsProvider = ({ appBridge, children }: AssetsProviderProps) => { | ||
const { blockAssets, addAssetIdsToKey, deleteAssetIdsFromKey } = useBlockAssets(appBridge); | ||
return ( | ||
<AssetsContext.Provider value={{ blockAssets, addAssetIdsToKey, deleteAssetIdsFromKey }}> | ||
{children} | ||
</AssetsContext.Provider> | ||
); | ||
}; |
Oops, something went wrong.