RowProxy
Generic types: | T |
Implements: |
|
RowProxy wraps the row so we can intercept changes to it and fire off the appropriate actions to update the store and the server.
Since proxying the row directly will cause the setter to throw an error when the NgRX rules are turned on that disallow mutating the row directly, we need to wrap the row in our own class that uses the Proxy class to handle the updates. By casting the RowProxy to type T (above) the rest of our code still believes it is working with the original row.
Constructor
This is the constructor for the RowProxy class. | ||||||||||||
Presentation
| ||||||||||||
Parameters
|
Properties
Name | Type | Description |
---|---|---|
changes | Record<string | symbol, unknown> | |
record | Record<string | symbol, unknown> |
Methods
delete()implements
|
---|
Initiates delete of this object from the server which will also optimistically update the store |
Presentation
|
Returnsvoid |
getRealRow() |
---|
This retrieves the backing row for this proxy |
Presentation
|
ReturnsT -the backing row for this proxy |
toJSON() |
---|
When we stringify this object, it needs to stringify the real row and any changes we've made to it. |
Presentation
|
ReturnsT & Record<string | symbol, unknown> -the real row with any changes we've made to it |