Closed hellno closed 9 months ago
136703df26
)Here are the sandbox execution logs prior to making any changes:
1736f8c
Checking src/common/components/NewPostEntry.tsx for syntax errors... ✅ src/common/components/NewPostEntry.tsx has no syntax errors!
1/1 ✓Checking src/common/components/NewPostEntry.tsx for syntax errors... ✅ src/common/components/NewPostEntry.tsx has no syntax errors!
Sandbox passed on the latest main
, so sandbox checks will be enabled for this issue.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
src/common/components/NewPostEntry.tsx
✓ https://github.com/hellno/herocast/commit/80b0289386adee5901c2573f0d2cc0314999b512 Edit
Modify src/common/components/NewPostEntry.tsx with contents:
• Import the `fetchMetadataFromCache` function from the `@mod-protocol/core` package. This function fetches metadata from the mod protocol metadata cache.
• Replace the `fetchUrlMetadata` function with the `fetchMetadataFromCache` function in the `getResults` and `getModChannels` functions. This will make these functions fetch metadata from the mod protocol metadata cache instead of fetching metadata on pageload.
• Replace the `fetchUrlMetadata` function with the `fetchMetadataFromCache` function in the `useEditor` hook. This will make the `useEditor` hook use the `fetchMetadataFromCache` function to fetch metadata for URLs.
--- +++ @@ -7,7 +7,7 @@ import { useHotkeys } from "react-hotkeys-hook"; import { useEditor, EditorContent, Editor } from "@mod-protocol/react-editor"; import { EmbedsEditor } from "@mod-protocol/react-ui-shadcn/dist/lib/embeds"; -import { fetchUrlMetadata } from "@mod-protocol/core"; +import { fetchMetadataFromCache } from "@mod-protocol/core"; import { Channel, getFarcasterChannels, @@ -22,7 +22,7 @@ const API_URL = process.env.NEXT_PUBLIC_MOD_PROTOCOL_API_URL!; const getResults = getFarcasterMentions(API_URL); const getModChannels = getFarcasterChannels(API_URL); -const getUrlMetadata = fetchUrlMetadata(API_URL); +const getUrlMetadata = fetchMetadataFromCache(API_URL); const onError = (err) => { console.error(err); @@ -106,7 +106,7 @@ getChannel, handleSubmit, } = useEditor({ - fetchUrlMetadata: getUrlMetadata, + fetchUrlMetadata: fetchMetadataFromCache, onError, onSubmit: onSubmitPost, linkClassName: "text-blue-300",
src/common/components/NewPostEntry.tsx
✓ Edit
Check src/common/components/NewPostEntry.tsx with contents:
Ran GitHub Actions for 80b0289386adee5901c2573f0d2cc0314999b512:
I have finished reviewing the code for completeness. I did not find errors for sweep/use_mod_protocol_metadata_cache_for_open_2
.
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord
See docs at: https://docs.modprotocol.org/metadata-cache
Checklist
- [X] Modify `src/common/components/NewPostEntry.tsx` ✓ https://github.com/hellno/herocast/commit/80b0289386adee5901c2573f0d2cc0314999b512 [Edit](https://github.com/hellno/herocast/edit/sweep/use_mod_protocol_metadata_cache_for_open_2/src/common/components/NewPostEntry.tsx#L10-L24) - [X] Running GitHub Actions for `src/common/components/NewPostEntry.tsx` ✓ [Edit](https://github.com/hellno/herocast/edit/sweep/use_mod_protocol_metadata_cache_for_open_2/src/common/components/NewPostEntry.tsx#L10-L24)