Skip to content

Commit

Permalink
fix: ensure consistency level header present for user search (#3029)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinbarron authored Feb 9, 2024
1 parent 156e30e commit 3d893b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/mgt-components/src/graph/graph.user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,15 @@ export const findUsers = async (graph: IGraph, query: string, top = 10, userFilt
}

const encodedQuery = `${query.replace(/#/g, '%2523')}`;
const graphBuilder = graph.api('users').search(`"displayName:${encodedQuery}" OR "mail:${encodedQuery}"`);
const graphBuilder = graph
.api('users')
.search(`"displayName:${encodedQuery}" OR "mail:${encodedQuery}"`)
.header('ConsistencyLevel', 'eventual')
.count(true);
let graphResult: CollectionResponse<User>;

if (userFilters !== '') {
graphBuilder.filter(userFilters).header('ConsistencyLevel', 'eventual').count(true);
graphBuilder.filter(userFilters);
}
try {
graphResult = (await graphBuilder.top(top).middlewareOptions(prepScopes(scopes)).get()) as CollectionResponse<User>;
Expand Down
2 changes: 1 addition & 1 deletion packages/mgt-element/src/utils/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
// THIS FILE IS AUTO GENERATED
// ANY CHANGES WILL BE LOST DURING BUILD

export const PACKAGE_VERSION = '3.1.3';
export const PACKAGE_VERSION = '4.0.0';

0 comments on commit 3d893b2

Please sign in to comment.