Hide contents view on empty permanodes.

Otherwise, we end up showing a stupid empty contents view for every
tweet, foursquare checkin, etc.

This has the downside that when you remove the last item from a
set, the contents view goes away.

Change-Id: If5f53a713aaff63d9fb294b675a5e55ca452eff1
This commit is contained in:
Aaron Boodman 2014-08-20 19:13:19 -07:00
parent c8c8e810cc
commit 90d1df956f
1 changed files with 11 additions and 0 deletions

View File

@ -175,6 +175,17 @@ cam.IndexPage = React.createClass({
// TODO(aa): Maybe we do want to for directories though?
return null;
}
// This is a hard case: if we're looking at a permanode and it doesn't have any children, should we render a contents view or not?
//
// If we do render a contents view, then we have this stupid empty contents view for lots of permanodes types that will probably never have children, like images, tweets, or foursquare checkins.
//
// If we don't render a contents view, then permanodes that are meant to actually be sets, but are currently empty won't have a contents view to drag items on to. And when you delete the last item from a set, the contents view will disappear.
//
// I'm not sure what the right long term solution is, but not showing a contents view in this case seems less crappy for now.
if (this.childSearchSession_ && !this.childSearchSession_.getCurrentResults().length) {
return null;
}
}
// This can happen when a user types a raw (JSON) query that is invalid.