feat: implement new feature for enhanced user experience

This commit is contained in:
2026-05-17 14:19:45 +00:00
parent db968ab318
commit f332c707b7
214 changed files with 424 additions and 2562 deletions
+64
View File
@@ -0,0 +1,64 @@
name: comments
meta:
label: { de: "Kommentare", en: "Comments" }
muiIcon: chat
group: content
preview:
label: author
secondary: message
tertiary: contentId
permissions:
public:
methods:
get: true
user:
methods:
get: true
post: true
put: true
delete: true
"token:${ADMIN_TOKEN}":
methods:
"get": true
"post": true
"put": true
"delete": true
hooks:
get:
read:
type: javascript
file: hooks/filter_public.js
fields:
- name: active
type: boolean
meta:
label: { de: "Sichtbar", en: "Visible" }
defaultValue: true
- name: contentId
type: string
validator:
required: true
meta:
label: { de: "Seite (Content)", en: "Page (Content)" }
widget: foreignKey
foreign:
collection: content
- name: author
type: string
validator:
required: true
meta:
label: { de: "Autor", en: "Author" }
- name: message
type: string
validator:
required: true
meta:
label: { de: "Nachricht", en: "Message" }
widget: textarea
+1
View File
@@ -28,6 +28,7 @@ collections:
- !include collections/content.yml
- !include collections/medialib.yml
- !include collections/navigation.yml
- !include collections/comments.yml
- !include collections/ssr.yml
assets:
+1 -1
View File
@@ -1,2 +1,2 @@
ADMIN_TOKEN=5bdfjc78hdxn338cuhSJ
ADMIN_ASSET_VERSION=4a604ba-dirty-1778608358546
ADMIN_ASSET_VERSION=db968ab-dirty-1779027503096
+44
View File
@@ -88,6 +88,50 @@ function ssrRequest(cacheKey, endpoint, query, options) {
// @ts-ignore
context.ssrDeps[collectionName + ":*"] = true
}
// --- EXTENSION: Track dependencies from lookup and aggregate ---
// Both `lookup` and `aggregate` parameters can inject data from other collections.
// We must invalidate the SSR cache if any of those referenced collections change.
if (options && options.lookup) {
const lookups = typeof options.lookup === "string" ? options.lookup.split(",") : [];
for (const l of lookups) {
// format: "fieldPath:collectionName"
const parts = l.split(":");
if (parts.length > 1) {
const targetCollection = parts[parts.length - 1];
// @ts-ignore
context.ssrDeps[targetCollection + ":*"] = true;
}
}
}
if (options && options.params && options.params.aggregate) {
const aggregates = typeof options.params.aggregate === "string"
? options.params.aggregate.split(",")
: [];
for (const a of aggregates) {
// simple format: "collectionName:foreignField:..."
// json format: '{"collection":"comments",...}'
try {
if (a.startsWith("{")) {
const parsed = JSON.parse(a);
if (parsed && parsed.collection) {
// @ts-ignore
context.ssrDeps[parsed.collection + ":*"] = true;
}
} else {
const parts = a.split(":");
if (parts.length > 0) {
const targetCollection = parts[0];
// @ts-ignore
context.ssrDeps[targetCollection + ":*"] = true;
}
}
} catch (e) {
// silently ignore parse errors here
}
}
}
// --- END EXTENSION ---
}
// @ts-ignore