slaveOftime / Fun.Blazor

Powered by .NET blazor!!! ❤ F#
https://slaveoftime.github.io/Fun.Blazor.Docs/
MIT License
192 stars 7 forks source link

Support collections in adaptiview #61

Closed masq6r closed 5 months ago

masq6r commented 5 months ago

adaptiview CE is really a brilliant idea and I found it very handy building dynamic pages. The CE's Bind implementation seems not support cset, aset, alist etc. Is there a plan to support them?

albertwoo commented 5 months ago

@masq6r thanks, I will explorer this use cases and see what I can do.

masq6r commented 5 months ago

I'm not so sure but maybe something like adaptlist, adaptmap?

albertwoo commented 5 months ago

We can make adaptiview to support alist or aset like:

adaptiview () {
            let! ls = AList.ofArray [| 1; 2 |]
            let! set = ASet.ofArray [| 1; 2 |]
            for x in ls do html.text x
            for x in set do html.text x
}

But not sure if adaptlist, adaptmap is needed. Because blazor has its own diff algorithm, the adaptiview is just to help ito make the scope smaller. Not sure how to integrate alist and aset with blazor diff more deeper.

masq6r commented 5 months ago

We can make adaptiview to support alist or aset like:

adaptiview () {
            let! ls = AList.ofArray [| 1; 2 |]
            let! set = ASet.ofArray [| 1; 2 |]
            for x in ls do html.text x
            for x in set do html.text x
}

But not sure if adaptlist, adaptmap is needed. Because blazor has its own diff algorithm, the adaptiview is just to help ito make the scope smaller. Not sure how to integrate alist and aset with blazor diff more deeper.

Thanks for your quick response. Your proposal looks good. Collection support would be a nice feature as there are so many changeable lists in real world apps.

albertwoo commented 5 months ago

Implemented https://github.com/slaveOftime/Fun.Blazor/pull/62