88 column ,
99 count ,
1010 type ExprNode ,
11- type MaybeArray ,
1211 Query ,
1312 sql ,
1413 sum ,
@@ -18,7 +17,6 @@ import { effect } from "@preact/signals-core";
1817
1918import { ValueCountsPlot } from "../utils/ValueCountsPlot.ts" ;
2019import { assert } from "../utils/assert.ts" ;
21- import { isFlechetteTable } from "../utils/guards.ts" ;
2220
2321interface UniqueValuesOptions {
2422 /** The table to query. */
@@ -43,28 +41,6 @@ export class ValueCounts extends MosaicClient {
4341 this . #table = options . table ;
4442 this . #column = options . field . name ;
4543 this . #field = options . field ;
46-
47- // FIXME: There is some issue with the mosaic client or the query we
48- // are using here. Updates to the Selection (`filterBy`) seem to be
49- // missed by the coordinator, and query/queryResult are not called
50- // by the coordinator when the filterBy is updated.
51- //
52- // Here we manually listen for the changes to filterBy and update this
53- // client internally. It _should_ go through the coordinator.
54- options . filterBy . addEventListener ( "value" , async ( ) => {
55- if ( ! this . #plot || ! this . coordinator ) {
56- return ;
57- }
58- let filters = options . filterBy . predicate ( this ) ;
59- assert (
60- isExprNodeArray ( filters ) ,
61- `Filter is not expression array: ${ filters } ` ,
62- ) ;
63- let query = this . query ( filters ) ;
64- let data = await this . coordinator . query ( query ) ;
65- assert ( isFlechetteTable ( data ) , "Expected a flechette table." ) ;
66- this . #plot. data . value = data ;
67- } ) ;
6844 }
6945
7046 override query ( filter : Array < ExprNode > = [ ] ) : Query {
@@ -130,9 +106,3 @@ export class ValueCounts extends MosaicClient {
130106 } ;
131107 }
132108}
133-
134- function isExprNodeArray (
135- x : MaybeArray < string | boolean | undefined | ExprNode > ,
136- ) : x is Array < ExprNode > {
137- return Array . isArray ( x ) && x . every ( ( y ) => typeof y === "object" ) ;
138- }
0 commit comments