Skip to content

Commit

Permalink
fix: lut not being propegated properly
Browse files Browse the repository at this point in the history
  • Loading branch information
k0beLeenders committed Dec 17, 2024
1 parent 6a011cf commit 1c74552
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/marginfi-v2-trading/src/hooks/useMarginfiClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function useMarginfiClient({
const group = groupsByGroupPk[groupPk.toBase58()];
const pool = arenaPools[groupPk.toBase58()];

if (!lut || !group || !pool) {
if (!group || !pool) {
return null;
}
const tokenBank = banksByBankPk[pool.tokenBankPk.toBase58()];
Expand Down
7 changes: 2 additions & 5 deletions apps/marginfi-v2-trading/src/store/tradeStoreV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ const stateCreator: StateCreator<TradeStoreV2State, [], []> = (set, get) => ({
poolsFetched: false,
userDataFetched: false,
isRefreshingStore: false,
lutGroupsCache: {},
groupsCache: {},
tokenMetadataCache: {},
bankMetadataCache: {},
searchResults: [],
currentPage: 1,
totalPages: 0,
Expand Down Expand Up @@ -212,6 +208,7 @@ const stateCreator: StateCreator<TradeStoreV2State, [], []> = (set, get) => ({

acc[pool.group] = {
groupPk: new PublicKey(pool.group),
luts: pool.lookup_tables.map((lut) => new PublicKey(lut)),
tokenSummary: {
bankPk: new PublicKey(tokenBankPk),
mint: new PublicKey(tokenMint.address),
Expand Down Expand Up @@ -399,7 +396,7 @@ const stateCreator: StateCreator<TradeStoreV2State, [], []> = (set, get) => ({
return acc;
}, {} as Record<string, MarginfiGroup>);

if (!lutByGroupPk) {
if (!lutByGroupPk || Object.keys(lutByGroupPk).length === 0) {
const lutResults: Record<string, Promise<RpcResponseAndContext<AddressLookupTableAccount | null>> | null> = {};

// Create lookup promises for each group
Expand Down

0 comments on commit 1c74552

Please sign in to comment.