Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider allowing adaptive views as an option #20

Open
dsyme opened this issue Oct 3, 2019 · 3 comments
Open

Consider allowing adaptive views as an option #20

dsyme opened this issue Oct 3, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@dsyme
Copy link
Contributor

dsyme commented Oct 3, 2019

This is about potentially allowing the use of adaptive view specifications, see https://github.com/fsprojects/FSharp.Data.Adaptive

From fabulous-dev/Fabulous#258 (comment)

@JaggerJo The FuncUI implementation is really good - this file is impressive https://github.com/dsyme/Avalonia.FuncUI/blob/master/src/Avalonia.FuncUI/Core/VirtualDom.fs

That said, it's still using view-reevaluation - for example if there are 10K data points in a chart and one is removed then the view is re-evaluated and, in the absence of other hacks, this will involve a significant amount of work to spot the minimal diff.

FuncUI can, I think, be adapted to work with adaptive data relatively easily. This would mean that the 'view' functions are not re-executed on update (except where necessary for incremental DOM maintenance). The diffs in the view would flow out of the adaptive data, rather than having to diff an old and new view like you do here

There's a sample showing how to define a tree of adaptive view-like data and perform incremental maintenance on a mutable HTMLElement data strucutre here: https://github.com/dsyme/FSharp.Data.Adaptive/blob/dom-node/src/FSharp.Data.Adaptive.Tests/DomUpdater.fs. The variation FuncUI would need would be a bit different - for example FuncUI could define a ViewReader for the AdaptiveView type, producing a ViewDelta (and then patch is called on that).

@JaggerJo JaggerJo added the enhancement New feature or request label Oct 9, 2019
@Swoorup
Copy link

Swoorup commented Mar 14, 2020

Does this mean that on a particular adaptive changes, you could avoid virtual diffing for that component, and just directly update that particular element using that adaptive variable?

@JaggerJo
Copy link
Member

@Swoorup Yes, exactly.

The hard thing is building a DSL that works well with the MVU architecture IMHO.

Im following @krauthaufen's progress here https://github.com/krauthaufen/Fable.Elmish.Adaptive

@Swoorup
Copy link

Swoorup commented Mar 18, 2020

Cool, sounds really useful for building realtime charts/graph which might have lot of data points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants