Skip to content

Commit 03b9633

Browse files
authored
Fix empty state when a user has no open shorts (#1834)
1 parent 0137ae9 commit 03b9633

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

apps/hyperdrive-trading/src/ui/portfolio/longs/LongsContainer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ export function OpenLongsContainer({
4141
);
4242
}
4343

44-
if (openLongPositions?.every((position) => !position.openLongs.length)) {
44+
if (
45+
!openLongPositions ||
46+
openLongPositions.every((position) => !position.openLongs.length)
47+
) {
4548
return (
4649
<PositionContainer className="my-28">
4750
<NonIdealState

apps/hyperdrive-trading/src/ui/portfolio/shorts/ShortsContainer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export function OpenShortsContainer({
4040
}
4141

4242
if (
43-
openShortPositions?.every((position) => position.openShorts.length === 0)
43+
!openShortPositions ||
44+
openShortPositions.every((position) => position.openShorts.length === 0)
4445
) {
4546
return (
4647
<PositionContainer className="my-28">

apps/hyperdrive-trading/src/ui/portfolio/shorts/usePortfolioShortsData.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export function usePortfolioShortsDataFromHyperdrives({
8484
address: hyperdrive.address,
8585
drift: getDrift({ chainId: hyperdrive.chainId }),
8686
earliestBlock: hyperdrive.initializationBlock,
87+
debugName: hyperdrive.name,
8788
zapContractAddress:
8889
appConfigForConnectedChain.zaps[hyperdrive.chainId]
8990
?.address,

packages/hyperdrive-js/src/hyperdrive/ReadHyperdrive.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,6 @@ export class ReadHyperdrive extends ReadClient {
987987
});
988988

989989
// Create a default empty short that we will update based on the events
990-
// const short: OpenShort = openShorts[assetId] || {
991990
openShorts[assetId] = openShorts[assetId] || {
992991
hyperdriveAddress,
993992
assetId: event.args.assetId,

0 commit comments

Comments
 (0)