Skip to content

Commit

Permalink
chore: prefer useCursor instead of deprecated isWithCursor
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Nov 11, 2023
1 parent 5dbc446 commit 876bb1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/examples/slickgrid/Example25.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ interface Props { }
interface State extends BaseSlickGridState {
metrics?: Metrics;
graphqlQuery: string;
isWithCursor: boolean;
processing: boolean;
selectedLanguage: string;
status: Status;
Expand Down Expand Up @@ -65,7 +64,6 @@ export default class Example25 extends React.Component<Props, State> {
this.state = {
gridOptions: undefined,
columnDefinitions: [],
isWithCursor: false,
graphqlQuery: '',
metrics: undefined,
processing: false,
Expand Down
6 changes: 3 additions & 3 deletions src/examples/slickgrid/Example6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class Example6 extends React.Component<Props, State> {
field: 'userId',
value: 123
}],
isWithCursor: this.state.isWithCursor, // sets pagination strategy, if true requires a call to setPageInfo() when graphql call returns
useCursor: this.state.isWithCursor, // sets pagination strategy, if true requires a call to setPageInfo() when graphql call returns
// when dealing with complex objects, we want to keep our field name with double quotes
// example with gender: query { users (orderBy:[{field:"gender",direction:ASC}]) {}
keepArgumentFieldDoubleQuotes: true
Expand Down Expand Up @@ -395,13 +395,13 @@ class Example6 extends React.Component<Props, State> {

setIsWithCursor(newValue: boolean) {
this.setState((state: State) => ({ ...state, isWithCursor: newValue }));
this.resetOptions({ isWithCursor: newValue });
this.resetOptions({ useCursor: newValue });
return true;
}

private resetOptions(options: Partial<GraphqlServiceOption>) {
const graphqlService = this.state.gridOptions!.backendServiceApi!.service as GraphqlService;
this.reactGrid.paginationService!.setCursorBased(options.isWithCursor!);
this.reactGrid.paginationService!.setCursorBased(options.useCursor as boolean);
this.reactGrid.paginationService?.goToFirstPage();
graphqlService.updateOptions(options);
this.setState((state: State) => ({
Expand Down

0 comments on commit 876bb1f

Please sign in to comment.