Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/legal-yaks-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@macalinao/grill": patch
---

fix error message for using context in wrong spot
9 changes: 6 additions & 3 deletions packages/grill/src/contexts/grill-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import { createContext, useContext } from "react";
export interface GrillContextValue {
/** DataLoader instance for batching and caching Solana account requests */
accountLoader: DataLoader<Address, EncodedAccount | null>;
/**
* Refetches the given accounts.
* @param addresses
* @returns
*/
refetchAccounts: (addresses: Address[]) => Promise<void>;

/**
Expand Down Expand Up @@ -50,9 +55,7 @@ export const GrillContext: React.Context<GrillContextValue | null> =
export const useGrillContext = (): GrillContextValue => {
const context = useContext(GrillContext);
if (!context) {
throw new Error(
"useSolanaAccountContext must be used within a SolanaAccountProvider",
);
throw new Error("useGrillContext must be used within a GrillProvider");
}
return context;
};