Open amark opened 9 years ago
I've had similar issues when using .path(path).put(obj)
, backing out and putting again, then calling .val
. It's as though like parts of the chain are breaking. Maybe something similar is happening here?
perhaps. :( arrrrrrrrgggh so many bugs to fiiiix.
The power of gun's chaining API is allowing for really complex emergent behavior. However the terror of gun's chaining API is making sure that all those possible permutations work as expected and intended! Yi yi yi.
My guess is that we've got a bit of the 80-20 rule going on here, where .path
seems to be at the center. If we iron out the bugs in .path
, it should take care of the vast majority of our problems.
... in theory.
and .map
because .map
allows for a context change such that this line allThePeople.map().path('friends').map().val()
explodes into a N*M operation, where val
gets called once for each friend, for each person.
Yipes! However, as a developer, I wouldn't expect that to be the most performant. Not the best excuse, but we should be able to back-burner it for now 😬
performance is not the point here, data is the point - I might legitimately want to show a visual graph of every person's friend. I know that isn't going to be performant, but that doesn't matter it is what my app does. GUN is a good use case for this, and therefore I should expect that graph traversal query to work. And as GUN authors we need to make sure that that graph traversal query works because it uses .map
and .path
which need to be rock solid and work no matter how you combine them. So that shouldn't be a back-burner (unless maybe I misunderstood you. Maybe you were saying performance needs to be a back-burner? Which yeah I agree with, since it being an NM operation is unavoidable. Sure in the future we can figure out tricks that make it faster, but the point is that if it is in RAM it should be fast even as an NM).
True! I'm not saying we avoid it altogether, and we certainly shouldn't allow features to take priority over crippling performance issues. But some of our performance issues are more widespread and troublesome than others (I'm looking at you, .path
). My concern is about focusing on our largest hurdles first. If that hurdle is .map
, then by all means!
I should've clarified further, I'm not suggesting we sweep it under the proverbial rug.
ah gotcha. Yeah, what I am saying is map().path().map()
or path().map().path()
or any other combination isn't a "feature" it is necessarily the API itself, the contract we give developers - the only thing they can rely upon. But you are right, path
's problem right now is the starting point to fix.
I agree, .map
is an important method, and should be as solid as it can be. Let's talk about this some more when we meet tomorrow!
Yupe :)
0.5+ (current release is in 0.6 range) have MAJORLY fixed many of these issues.
However I still don't think I've tested doing a put after a map. Still would be nice, so gonna leave this open.
uggh, when I ran this code:
it only added
theTeam
to the first item it mapped over, not both items it mapped over.Does this happen constantly?