Skip to content

Commit

Permalink
Fixed discussion sorting in a post page
Browse files Browse the repository at this point in the history
  • Loading branch information
dkildar committed Jan 31, 2025
1 parent 80244ed commit b75dc4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 10 additions & 3 deletions src/api/queries/get-discussions-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,17 @@ export function sortDiscussions(entry: Entry, discussion: Entry[], order: SortOr
export const getDiscussionsQuery = (
entry: Entry,
order: SortOrder = SortOrder.created,
enabled: boolean = true
, observer?: string) =>
enabled: boolean = true,
observer?: string
) =>
EcencyQueriesManager.generateClientServerQuery({
queryKey: [QueryIdentifiers.FETCH_DISCUSSIONS, entry?.author, entry?.permlink, observer||entry?.author],
queryKey: [
QueryIdentifiers.FETCH_DISCUSSIONS,
entry?.author,
entry?.permlink,
order,
observer || entry?.author
],
queryFn: async () => {
const response = await bridgeApiCall<Record<string, Entry> | null>("get_discussion", {
author: entry.author,
Expand Down
3 changes: 0 additions & 3 deletions src/features/shared/discussion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ interface Props {
hideControls: boolean;
}

const PAGE_SIZE = 50;

export function Discussion({ hideControls, isRawContent, parent, community }: Props) {
const activeUser = useGlobalStore((s) => s.activeUser);
const previousIsRawContent = usePrevious(isRawContent);

const [visible, setVisible] = useState(false);
const [order, setOrder] = useState(SortOrder.trending);
const { updateEntryQueryData } = EcencyEntriesCacheManagement.useUpdateEntry();
const [page, setPage] = useState(1);

const { isLoading, data } = getDiscussionsQuery(
parent,
Expand Down

0 comments on commit b75dc4b

Please sign in to comment.