-
Notifications
You must be signed in to change notification settings - Fork 70
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
WG opening listing sorted in chronological order (#2513) #4191
base: dev
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/ui/src/working-groups/queries/__generated__/workingGroups.generated.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Theophile Sandoz <[email protected]>
I understand that but in the comment I was questioning weither there was an issue in the first place. Could you link to an example please ? Also to fix the CI please reverse the change on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ERROR in src/working-groups/hooks/useOpeningsPagination.ts:30:5
--
13:16:25.045 | \| TS2322: Type 'WorkingGroupOpeningOrderByInput.CreatedAtDesc[]' is not assignable to type 'InputMaybe<WorkingGroupOpeningOrderByInput> \| undefined'.
13:16:25.045 | \| Type 'WorkingGroupOpeningOrderByInput.CreatedAtDesc[]' is not assignable to type 'WorkingGroupOpeningOrderByInput.UpdatedAtDesc'.
13:16:25.045 | \| 28 \| offset: (page - 1) * OPENINGS_PER_PAGE,
13:16:25.045 | \| 29 \| where,
13:16:25.045 | \| > 30 \| order: [WorkingGroupOpeningOrderByInput.CreatedAtDesc],
13:16:25.045 | \| \| ^^^^^
13:16:25.045 | \| 31 \| }
13:16:25.045 | \| 32 \|
13:16:25.045 | \| 33 \| const { data, loading, error } = useGetWorkingGroupOpeningsQuery({ variables })
13:16:25.045 | \|
13:16:25.045 | \| webpack 5.64.3 compiled with 1 error in 106165 ms
@@ -722,7 +722,7 @@ export type CountWorkingGroupWorkersQuery = { | |||
|
|||
export type GetWorkingGroupOpeningsQueryVariables = Types.Exact<{ | |||
where?: Types.InputMaybe<Types.WorkingGroupOpeningWhereInput> | |||
order?: Types.InputMaybe<Array<Types.WorkingGroupOpeningOrderByInput> | Types.WorkingGroupOpeningOrderByInput> | |||
order?: Types.InputMaybe<Types.WorkingGroupOpeningOrderByInput> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
order?: Types.InputMaybe<Types.WorkingGroupOpeningOrderByInput> | |
order?: Types.InputMaybe<Array<Types.WorkingGroupOpeningOrderByInput> | Types.WorkingGroupOpeningOrderByInput> |
…513-sortingList
@@ -27,7 +27,7 @@ export const useOpeningsPagination = ({ groupId, type, page = 1 }: UseOpeningsPa | |||
limit: OPENINGS_PER_PAGE, | |||
offset: (page - 1) * OPENINGS_PER_PAGE, | |||
where, | |||
order: [WorkingGroupOpeningOrderByInput.CreatedAtDesc, WorkingGroupOpeningOrderByInput.RuntimeIdDesc], | |||
order: [WorkingGroupOpeningOrderByInput.CreatedAtDesc], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly this #2513 (comment), the issue is that the openings are ordered by ascending creation date. So this line (order: [WorkingGroupOpeningOrderByInput.CreatedAtDesc, WorkingGroupOpeningOrderByInput.RuntimeIdDesc]
looks fine to me, but the problem is still not solved on the preview branch /working-groups/openings
:
So I'm guessing that maybe this useOpeningsPagination
is used to query the openings on a different page. E.g on the WG past openings page the order is correct even in production.
In conclusion I think this change should be reversed and either the hook used to query /working-groups/openings
should be fixed or an even better solution would be to reuse the same hook to query openings everywhere.
Also please get reviews from BWG workers before setting jsg-code-review
.
fixes #2513
I have closed the old PR, #3862.
This is the new PR based on the recent dev branch.