Skip to content
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

Perspective view better pagination -- https://github.com/ispras/lingvodoc-react/issues/1133 #1134

Merged
merged 13 commits into from
Aug 11, 2024
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