PolymerLabs / uni-virtualizer

Monorepo for a "universal" (renderer-agnostic) virtual scroller and renderer-specific variants

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

confusing assignment in condition....

cintaccs opened this issue · comments

in class VirtualRepeater

_assignChild(idx) {
...
if (child = this._keyToChild.get(key)) {
...

Having an assignment in the condition ... ? Should it be:

        let child = this._keyToChild.get(key);
        if (child) {

Thanks for the issue, @cintaccs.

I agree that this is confusing and should be replaced along the lines you suggest. (And frankly, there are probably a bunch of issues along these lines in the current codebase.)

That said, this code in particular is destined to be removed; it's already gone from the better-grid branch where active development is happening at the moment.

I'm also planning for a thorough code review before landing the work in that branch, so we should catch issues of this type in that process.

Given the above, I'm going to go ahead and close this.