|
565 | 565 | * that changes are constantly synchronized (allowing basic state preservation |
566 | 566 | * between browser tabs, for example). The framework has some basic provisions |
567 | 567 | * to prevent race conditions - for example it will not attempt to save data if |
568 | | - * it is currently loading it and vice-versa. |
| 568 | + * it is currently loading it and vice-versa - and will sequentially schedule |
| 569 | + * methods that could cause race conditions. |
569 | 570 | * |
570 | | - * Be aware, however, that the default implementations do not provide complex |
571 | | - * synchronization heuristics and you should comprehensively test your |
| 571 | + * That said, be aware that you should always comprehensively test your |
572 | 572 | * persistence strategy to understand the opportunity for data loss (in the case |
573 | 573 | * of trying to save data to a server under poor network conditions, for |
574 | 574 | * example). |
| 575 | + * |
| 576 | + * To help debug such issues, since v4.0.4, the create methods for all Persister |
| 577 | + * objects take an optional `onIgnoredError` argument. This is a handler for the |
| 578 | + * errors that the Persister would otherwise ignore when trying to save or load |
| 579 | + * data (such as when handling corrupted stored data). It's recommended you use |
| 580 | + * this for debugging persistence issues, but only in a development environment. |
| 581 | + * Database-based Persister objects also take an optional `onSqlCommand` |
| 582 | + * argument for logging commands and queries made to the underlying database. |
575 | 583 | * @example |
576 | 584 | * This example creates a Store, persists it to the browser's session storage as |
577 | 585 | * a JSON string, changes the persisted data, updates the Store from it, and |
|
1052 | 1060 | * @param delPersisterListener A function that will unregister the listener from |
1053 | 1061 | * the underlying changes to the persistence layer. It receives whatever was |
1054 | 1062 | * returned from your `addPersisterListener` implementation. |
| 1063 | + * @param onIgnoredError An optional handler for the errors that the Persister |
| 1064 | + * would otherwise ignore when trying to save or load data. This is suitable for |
| 1065 | + * debugging persistence issues in a development environment, since v4.0.4. |
1055 | 1066 | * @returns A reference to the new Persister object. |
1056 | 1067 | * @example |
1057 | 1068 | * This example creates a custom Persister object and persists the Store to a |
|
0 commit comments