Skip to content

Commit

Permalink
Merge pull request #138 from CartoDB/mmorillo/ch79584/popup-error-wit…
Browse files Browse the repository at this point in the history
…h-cartodb-id-column

Prevent adding the column carotbd_id as aggregation column
  • Loading branch information
Manuel J. Morillo authored Jun 8, 2020
2 parents fe6f5c5 + 91671de commit 0d78cf5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/viz/src/lib/layer/Layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
} from './LayerInteractivity';
import { LayerOptions } from './LayerOptions';

const DEFAULT_ID_PROPERTY = 'cartodb_id';

export class Layer extends WithEvents implements StyledLayer {
private _source: Source;
private _style: Style;
Expand Down Expand Up @@ -414,7 +416,8 @@ export class Layer extends WithEvents implements StyledLayer {
{
column: this._style.field,
sample: true,
aggregation: true
// prevent aggregating by the id column
aggregation: this._style.field !== DEFAULT_ID_PROPERTY
}
];
}
Expand All @@ -427,7 +430,8 @@ export class Layer extends WithEvents implements StyledLayer {
const field = {
column,
sample: false,
aggregation: true
// prevent aggregating by the id column
aggregation: column !== DEFAULT_ID_PROPERTY
};
this._fields.push(field);
});
Expand Down

1 comment on commit 0d78cf5

@vercel
Copy link

@vercel vercel bot commented on 0d78cf5 Jun 8, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.