widgetti / ipyreact

React for ipywidgets that just works. No webpack, no npm, no hassle
BSD 3-Clause "New" or "Revised" License
119 stars 8 forks source link

Is custom message passing possible? #70

Open paddymul opened 6 days ago

paddymul commented 6 days ago

I'm double checking. I see this https://github.com/widgetti/ipyreact?tab=readme-ov-file#events

and this bit from anywidget https://anywidget.dev/en/jupyter-widgets-the-good-parts/#2-custom-messages

Are the two equivalent?

My widget overwhelmingly fits into the react/reactive model. I will be implementing lazy loading of data from python based on scrolling. I currently have that working via a convoluted react pattern where I memoize a cache, set args that are responded to in a later update of the element props. Then the cache is polled by the original scroll request. This is a mess obviously, and latent.

If I had access to the backbone model from the _esm exported function, I could implement what I'm thinking of.

So two questions:

  1. will your implementation of events accomodate this in the same way that anywidget does?
  2. what would you think of a "secret" extra prop of _model that allows these perversions of the react model?