Skip to content

Commit

Permalink
add orderBy in query loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Sep 1, 2020
1 parent 5ebbd9e commit c0f5dca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/block-library/src/query-loop/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const TEMPLATE = [ [ 'core/post-title' ], [ 'core/post-content' ] ];
export default function QueryLoopEdit( {
clientId,
context: {
query: { perPage, offset, categoryIds, order } = {},
query: { perPage, offset, categoryIds, order, orderBy } = {},
queryContext,
},
} ) {
Expand All @@ -32,6 +32,7 @@ export default function QueryLoopEdit( {
offset: perPage ? perPage * ( page - 1 ) + offset : 0,
categories: categoryIds,
order,
orderby: orderBy,
};
if ( perPage ) {
query.per_page = perPage;
Expand All @@ -45,7 +46,7 @@ export default function QueryLoopEdit( {
blocks: select( 'core/block-editor' ).getBlocks( clientId ),
};
},
[ perPage, page, offset, categoryIds, order, clientId ]
[ perPage, page, offset, categoryIds, order, orderBy, clientId ]
);

const blockContexts = useMemo(
Expand Down

0 comments on commit c0f5dca

Please sign in to comment.