Skip to content

Commit

Permalink
Perspective view better pagination -- #1133 (#1134)
Browse files Browse the repository at this point in the history
* init

* next steps

* PerspectivePage methods moved to DictionaryPerspective

* next steps

* refactoring

* regexp

* some workaround

* some workaround

* fixes and cleanup

* more correct filtering

* next steps

* refactoring

* created entries calculating
  • Loading branch information
vmonakhov authored Aug 11, 2024
1 parent 17317a8 commit 96c9959
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 139 deletions.
22 changes: 11 additions & 11 deletions src/components/LexicalEntry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import PropTypes from "prop-types";
import { compose, pure } from "recompose";

import { queryCounter } from "backend";
import { queryLexicalEntries } from "components/PerspectiveView";
import { queryLexicalEntries, fragmentPerspectivePageVariables } from "components/PerspectiveView";
import { compositeIdToString, compositeIdToString as id2str } from "utils/compositeId";

import GroupingTag from "./GroupingTag";
Expand Down Expand Up @@ -138,17 +138,20 @@ class Entities extends React.Component {
}
});

// Current variables for queryLexicalEntries are stored as fragment
const data_perspective_variables = client.readFragment(fragmentPerspectivePageVariables);

const data_perspective = client.readQuery({
query: queryLexicalEntries,
variables: {
id: perspectiveId,
entitiesMode
}
variables: data_perspective_variables ?? {}
});

const {
perspective: { lexical_entries }
} = data_perspective;
perspective: { perspective_page: { lexical_entries } }
} = data_perspective ? data_perspective : {
// TODO: here is a dirty workaround, readQuery above should have
// full set of variables and work correctly
perspective: { perspective_page: { lexical_entries: [] } } };

const entry_id_str = id2str(entry.id);

Expand Down Expand Up @@ -184,10 +187,7 @@ class Entities extends React.Component {

client.writeQuery({
query: queryLexicalEntries,
variables: {
id: perspectiveId,
entitiesMode
},
variables: data_perspective_variables ?? {},
data: data_perspective
});
}
Expand Down
Loading

0 comments on commit 96c9959

Please sign in to comment.