fix initial hotbar not showing (#2551)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2021-04-20 09:09:13 +03:00
1 parent 8dde4a1ecb
commit 8d42d40433
3 files changed
+37 -9

No files matched your search

@@ -14,20 +14,24 @@ interface Props {
@observer
export class HotbarMenu extends React.Component<Props> {
render() {
const { className } = this.props;
get hotbarItems() {
const hotbar = hotbarStore.getByName("default"); // FIXME
if (!hotbar) {
return null;
return [];
}
const items = hotbar.items.map((item) => catalogEntityRegistry.items.find((entity) => entity.metadata.uid === item.entity.uid)).filter(Boolean);
return hotbar.items.map((item) => catalogEntityRegistry.items.find((entity) => entity.metadata.uid === item.entity.uid)).filter(Boolean);
}
render() {
const { className } = this.props;
return (
<div className={cssNames("HotbarMenu flex column", className)}>
<div className="items flex column gaps">
{items.map((entity, index) => {
{this.hotbarItems.map((entity, index) => {
return (
<HotbarIcon
key={index}