Skip to content

Commit

Permalink
Merge branch 'develop' into upkeep/hook-use-post
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 authored Mar 13, 2024
2 parents d71d91b + f9e04c4 commit 4251415
Show file tree
Hide file tree
Showing 3 changed files with 2,012 additions and 164 deletions.
9 changes: 7 additions & 2 deletions hooks/use-media/index.js → hooks/use-media/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useSelect } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import type { Attachment } from '@wordpress/core-data';

export function useMedia(id) {
export function useMedia(id: number) {
return useSelect(
(select) => {
const { getMedia, isResolving, hasFinishedResolution } = select(coreStore);
Expand All @@ -15,5 +16,9 @@ export function useMedia(id) {
};
},
[id],
);
) as {
media: Attachment | undefined;
isResolvingMedia: boolean;
hasResolvedMedia: boolean;
};
}
Loading

0 comments on commit 4251415

Please sign in to comment.