Skip to content

Conversation

benesch
Copy link
Contributor

@benesch benesch commented Jun 30, 2017

I broke this in #1477. Guess it wasn't "dead code." 🤦‍♂️

I broke this in cockroachdb#1477. Guess it wasn't "dead code."
@benesch benesch requested review from kuanluo and jseldess June 30, 2017 23:58
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@cockroach-teamcity
Copy link
Member

@benesch
Copy link
Contributor Author

benesch commented Jul 1, 2017

Copy link
Contributor

@justinj justinj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of my comments have to do with the correctness of this, so don't hold off on my account if you're eager to get this merged to fix it.

})();

function renderItems(items, tier) {
function renderItems(items, paths) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dunno how much we care about this for this code, but I might appreciate a comment showing the structure of the objects here since (I don't think) that's something you can easily figure out from this file.

});
var subitems = renderItems(item.items, tier + 1);
var active = (urls.indexOf(location.pathname) !== -1);
if (active) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not personally a huge fan of doing mutation within a map, maybe it would be clearer to change it to a forEach and append to a list at the end? Or even just extract this block into a function (if there's an easy way to do that)?

var subitems = renderItems(item.items, tier + 1);
var active = (urls.indexOf(location.pathname) !== -1);
if (active) {
$("#ch-breadcrumbs")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I see what's happening here, you want to eventually overwrite with the value that occurs at the deepest point in the recursion? After figuring this out I think this logic is subtle enough that it could do with a comment explaining what's happening here, or maybe even pull this whole thing out into a separate function?

@benesch
Copy link
Contributor Author

benesch commented Jul 2, 2017

All good points, but going to address in a follow-up PR to get this merged!

@benesch benesch merged commit f35e41d into cockroachdb:master Jul 2, 2017
@benesch benesch deleted the fix-mobile-breadcrumbs branch July 2, 2017 15:54
benesch added a commit to benesch/docs that referenced this pull request Jul 4, 2017
benesch added a commit to benesch/docs that referenced this pull request Jul 4, 2017
benesch added a commit to benesch/docs that referenced this pull request Jul 4, 2017
benesch added a commit to benesch/docs that referenced this pull request Jul 4, 2017
@kuanluo
Copy link

kuanluo commented Jul 5, 2017

Thank you, @benesch for the quick fix! 👍

@benesch
Copy link
Contributor Author

benesch commented Jul 5, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants