@@ -77,6 +77,7 @@ export default async function RenderTemplate(
|
||||
bodyshop: bodyshop,
|
||||
filters: templateObject?.filters,
|
||||
sorters: templateObject?.sorters,
|
||||
defaultSorters: templateObject?.defaultSorters,
|
||||
offset: bodyshop.timezone, //dayjs().utcOffset(),
|
||||
},
|
||||
};
|
||||
@@ -406,9 +407,12 @@ const fetchContextData = async (templateObject, jsrAuth) => {
|
||||
// console.log('Unmodified Query');
|
||||
// console.dir(templateQueryToExecute);
|
||||
|
||||
const hasFilters = templateObject?.filters?.length > 0;
|
||||
const hasSorters = templateObject?.sorters?.length > 0;
|
||||
const hasDefaultSorters = templateObject?.defaultSorters?.length > 0;
|
||||
|
||||
// We have no template filters or sorters, so we can just execute the query and return the data
|
||||
if (!(templateObject?.filters?.length || templateObject?.sorters?.length)) {
|
||||
if (!hasFilters && !hasSorters && !hasDefaultSorters) {
|
||||
let contextData = {};
|
||||
if (templateQueryToExecute) {
|
||||
const {data} = await client.query({
|
||||
|
||||
@@ -87,6 +87,8 @@ export async function generateTemplate(templateQueryToExecute, templateObject, u
|
||||
|
||||
if (templateObject?.sorters && templateObject?.sorters?.length) {
|
||||
applySorters(ast, templateObject.sorters);
|
||||
} else if (templateObject?.defaultSorters && templateObject?.defaultSorters?.length) {
|
||||
applySorters(ast, templateObject.defaultSorters);
|
||||
}
|
||||
|
||||
const finalQuery = printQuery(ast);
|
||||
|
||||
Reference in New Issue
Block a user