What, where
When using a page-list component and leaving it empty the return value is sometimes null, not as expexted an emtpy Node[].
From the AppData interface it should always be an array of Nodes.
export interface AppData {
get(...key: string[]): unknown;
getNode(key: string): Node;
getArray(key: string): Node[];
getNumber(key: string): number;
}
Example
config/index.html
<input
type="hidden"
data-types="sv:archive"
data-component="page-list"
name="articlePathNodes"
id="articlePathNodes"
data-sortable
/>
...
let articlePathNodes = appData.getArray("articlePathNodes") as Node[];
articlePathNodes = articlePathNodes.filter((node: Node) => nodeTypeUtil.isArchive(node));
...
The resulting error is only visible on the addon preview.
EcmaError: TypeError: Cannot call method "filter" of null (<sitevision>#1890)
What, where
When using a page-list component and leaving it empty the return value is sometimes
null, not as expexted an emtpyNode[].From the AppData interface it should always be an array of Nodes.
Example
config/index.html
The resulting error is only visible on the addon preview.