zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.45k stars 3.02k forks source link

[GPUI]: Support signals for state managing #10462

Closed MrHeer closed 6 months ago

MrHeer commented 6 months ago

Check for existing issues

Describe the feature

Abstract

First of all, GPUI is very cool and can take advantage of rust to build UIs. From what I've learned, you've borrowed a lot of web technologies such as Tailwind CSS, component-based development model, and so on. Many front-end frameworks today have introduced Signal-like concepts to manage state. In addition, tc39 is also actively promoting the standardization of Signals to JavasScript.

Background: Why Signals?

To develop a complicated user interface (UI), JavaScript application developers need to store, compute, invalidate, sync, and push state to the application's view layer in an efficient way. UIs commonly involve more than just managing simple values, but often involve rendering computed state which is dependent on a complex tree of other values or state that is also computed itself. The goal of Signals is to provide infrastructure for managing such application state so developers can focus on business logic rather than these repetitive details.

Signal-like constructs have independently been found to be useful in non-UI contexts as well, particularly in build systems to avoid unnecessary rebuilds.

References

mikayla-maki commented 6 months ago

Thanks for the idea, if you have a more detailed suggestion on how we should do this, please re-open :)