Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

Fix items not defined error in Listview when clicking on trash (#4)

Waqar Ahmed3d3d1878f5f8
diff --git a/apps/web/src/components/listview/index.js b/apps/web/src/components/listview/index.js
index 32322aa48..40a714323 100644
--- a/apps/web/src/components/listview/index.js
+++ b/apps/web/src/components/listview/index.js
@@ -20,35 +20,37 @@ function ListView({ type, getItems, menu, button }) {
};
}, [getItems, type]);
return (
- <ListContainer
- itemsLength={items.length}
- item={index => {
- const item = items[index];
- return (
- <ListItem
- title={item.title}
- body={item.headline}
- index={index}
- onClick={() => {}} //TODO
- info={
- <Flex justifyContent="center" alignItems="center">
- <TimeAgo datetime={item.dateDeleted || item.dateCreated} />
- <Text as="span" mx={1}>
- •
- </Text>
- <Text color="primary">
- {item.type[0].toUpperCase() + item.type.substring(1)}
- </Text>
- </Flex>
- }
- menuData={item}
- menuItems={menu.menuItems(item)}
- dropdownRefs={menu.dropdownRefs}
- />
- );
- }}
- button={button}
- />
+ items && (
+ <ListContainer
+ itemsLength={items.length}
+ item={index => {
+ const item = items[index];
+ return (
+ <ListItem
+ title={item.title}
+ body={item.headline}
+ index={index}
+ onClick={() => {}} //TODO
+ info={
+ <Flex justifyContent="center" alignItems="center">
+ <TimeAgo datetime={item.dateDeleted || item.dateCreated} />
+ <Text as="span" mx={1}>
+ •
+ </Text>
+ <Text color="primary">
+ {item.type[0].toUpperCase() + item.type.substring(1)}
+ </Text>
+ </Flex>
+ }
+ menuData={item}
+ menuItems={menu.menuItems(item)}
+ dropdownRefs={menu.dropdownRefs}
+ />
+ );
+ }}
+ button={button}
+ />
+ )
);
}