Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fix pagination for fills #5228

Merged
merged 2 commits into from
Dec 19, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Props = {
}

export const FillsTableWithData: React.FC<Props> = ({ areTokensLoaded, order, isPriceInverted, invertPrice }) => {
const { trades, tableState } = useContext(FillsTableContext)
const { data: trades, tableState } = useContext(FillsTableContext)
const isFirstRender = useFirstRender()

return isFirstRender || !areTokensLoaded ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Trade } from 'api/operator'
import { TableState, TableStateSetters } from '../../../../explorer/components/TokensTableWidget/useTable'

type CommonState = {
trades: Trade[]
data: Trade[]
isLoading: boolean
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shoom3301 this one was hard to debug, cause the error comes from some unsafety casting done in the pagination.

I could see the context being injected:
Screenshot at Dec 18 12-30-13

However, because there's this type casting here:
image

We don't get compile errors. Basically, was assuming there will be something called data, but instead injected something called trades

This PR is about fixing the issue to get it out, but maybe we should add to the technical debt this too

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks for the information.
This context should definetely be refactored to jotai atom, at least in terms of code-base consistency.

tableState: TableState
} & TableStateSetters
Expand Down
4 changes: 2 additions & 2 deletions apps/explorer/src/components/orders/OrderDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export type Props = {

export enum TabView {
OVERVIEW = 1,
FILLS,
FILLS = 2,
}

const DEFAULT_TAB = TabView[1]
Expand Down Expand Up @@ -225,7 +225,7 @@ export const OrderDetails: React.FC<Props> = (props) => {
))}
<FillsTableContext.Provider
value={{
trades,
data: trades,
isLoading: areTradesLoading,
tableState,
setPageSize,
Expand Down
Loading