@faybl/client 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/package.json +1 -1
- package/src/dataset.js +3 -1
package/README.md
CHANGED
|
@@ -226,7 +226,8 @@ broker refuses the subscription. Changes published while the connection is down
|
|
|
226
226
|
|
|
227
227
|
`createDataset(client, spec)` returns:
|
|
228
228
|
|
|
229
|
-
- `init()`, which resolves once loaded, or rejects with the error that stopped it.
|
|
229
|
+
- `init()`, which resolves once loaded, or rejects with the error that stopped it. Called again
|
|
230
|
+
after a rejection, it loads again.
|
|
230
231
|
- `getRecords()`.
|
|
231
232
|
- `subscribe(callback)` and `unsubscribe(callback)`, without a callback removing them all. A
|
|
232
233
|
callback gets `{ type, rid, record, previous }` after the records have changed, with `type`
|
package/package.json
CHANGED
package/src/dataset.js
CHANGED
|
@@ -170,8 +170,10 @@ export const createDataset = (client, spec) => {
|
|
|
170
170
|
const machine = createActor(createDatasetMachine(client, spec, notify));
|
|
171
171
|
return {
|
|
172
172
|
machine,
|
|
173
|
+
// After a failed load, init starts it over, so it can be called until it resolves.
|
|
173
174
|
init: async () => {
|
|
174
|
-
machine.
|
|
175
|
+
if (machine.getSnapshot().matches('Error')) machine.send({ type: 'retry' });
|
|
176
|
+
else machine.start();
|
|
175
177
|
await datasetLoaded(machine);
|
|
176
178
|
},
|
|
177
179
|
subscribe: (callback) => {
|