cferdinandi / reef

A lightweight library for creating reactive, state-based components and UI.

Home Page:https://reefjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proxies for reactivity are ruining performance

cferdinandi opened this issue · comments

Reduced Test Case: https://codepen.io/cferdinandi/pen/VwMpoYQ

If you click the Swap Wizards button a few times, it works fine. If you focus on the button and hold the enter/return key down to trigger a swap multiple times, the nested proxy structure overloads the browser and freezes the app.

Switching to a setter function style approach as the only way to update reactively would dramatically improve performance.

so this is not fixed yet, right? reactivity wouldn't be using proxies in next release?

Correct, but it should be later today. I've got a solution after scouring the interwebz: https://gomakethings.com/better-proxy-performance-in-vanilla-js/

Patched in 10.0.1

@cferdinandi this library is very light weight and cool. I have some concern like, I want template to come from backend. which means entire block of HTML should come as string and then I am doing to use in render. functions and all should stay in js file only. just the HTML template will come from backend. I have some requirements like I need something like *ngIf in angular, custom attribute if applied to HTML tag shouldn't appear in real DOM based on boolean, or iterate same tag for given array items. Is there any such functionality in reef present? I don't want to separate blocks of HTML into different functions with if else like react. :(

@pranav-js please open a new issue for this