Replies: 1 comment 3 replies
-
You could just use nested signals, avoiding the need to regenerate the entire object. const map = signal(new OpenlayersMap({
layers: signal([
new TileLayer({
source: new OSM(),
}),
]),
target: 'map',
view: signal(new View({
center: [0, 0],
})),
})); etc. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Signal Trait Proposal
Hey, I believe signals are missing a crucial feature, and that is the concept of "traits."
Problem Scenario
When dealing with a complex and massive object, it becomes impractical or costly to regenerate it every time there is a change. Signals seem to face difficulties in updating in such scenarios. As an example, consider the use of OpenLayers in the following scenario. The
map
object is highly complex, making it challenging to regenerate the entire map reference when internal properties are updated, thus preventing the signal from updating.Solution
The solution is to introduce the concept of "Trait" to extract features from signals. By default, the feature of a signal is the value's self, and advanced features can be implemented as needed.
API Design
In this way, traits enhance the capabilities of signals, allowing for more effective updates in complex scenarios.
Beta Was this translation helpful? Give feedback.
All reactions