How to call multiple Makie recipes for heterogeneous collections?

The MWE is self-explanatory:

using GLMakie
import Makie

# type hierarchy
abstract type G end
struct G1 <: G end
struct G2 <: G end

# define recipe for vector of G
Makie.@recipe(MyPlot, gs) do scene
  Makie.Attributes()
end

# split heterogeneous vector into homogeneous vectors
function Makie.plot!(plot::MyPlot{<:Tuple{AbstractVector{<:G}}})
  # retrieve unique types
  Gs = unique(map(typeof, plot.gs[])) # issue 1

  # register compute node and dispatch plot for each type
  for (i, G) in enumerate(Gs)
    # add indices to compute graph
    guid = Symbol(:inds, i)
    Makie.map!(plot, :gs, guid) do gs
      findall(g -> g isa G, gs)
    end

    # dispatch plot for this specific type
    inds = plot[guid][] # issue 2
    plottext!(plot, G, inds)
  end
end

# recipe for type G1
function plottext!(plot::MyPlot, ::Type{G1}, inds)
  Makie.text!(plot, inds, fill(0, length(inds)), text=fill("G1", length(inds)))
end

# recipe for type G2
function plottext!(plot::MyPlot, ::Type{G2}, inds)
  Makie.text!(plot, inds, fill(0, length(inds)), text=fill("G2", length(inds)))
end

# initialize plot
gs = Observable([G1(), G2(), G1(), G2()])
myplot(gs)

# doesn't work
gs[] = [G1(), G1()]

I’ve marked the code with issue 1 and issue 2, which are the two places where I needed direct access to node contents. Is there any method to make this plot interactive?

If you know all the types at first call, you can set it up statically. If you don’t, probably easiest to use plotlist like in the other post.