Skip to content

Commit

Permalink
Closes JuliaComputing#26 - Only wrap with invokelatest on the first use
Browse files Browse the repository at this point in the history
Minor adjustment to return the invokelatest wrapped filter on the first use. The world will be ready for the actual function on subsequent uses.
  • Loading branch information
jekelsc committed Jun 21, 2019
1 parent bb0cf67 commit 11b011f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/TableView.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ function _filterfn(filtermodel)
return _filterfns[code]
end

println("For filterModel: $filtermodel")
println("Built code: $code")
return _filterfns[code] = eval(Meta.parse(code))
fltr = _filterfns[code] = eval(Meta.parse(code))
# On the first call, we need to wrap the function to invokelatest
return (row) -> Base.invokelatest(fltr, row)
end

function _showtable_async!(w, names, types, rows, coldefs, tablelength, dark, id, onCellValueChanged)
Expand All @@ -291,10 +291,7 @@ function _showtable_async!(w, names, types, rows, coldefs, tablelength, dark, id
on(rowparams) do x
filtermodel = x["filterModel"]
if length(filtermodel) > 0
fltr = _filterfn(filtermodel)
data = Base.Iterators.filter(rows) do row
Base.invokelatest(fltr, row)
end
data = Base.Iterators.filter(_filterfn(filtermodel), rows)
else
data = rows
end
Expand Down

0 comments on commit 11b011f

Please sign in to comment.