@fireproof/core 0.20.4-dev-preview-4 → 0.20.5-dev-preview-1
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/deno/index.js +2 -1
- package/deno/index.js.map +1 -1
- package/deno/metafile-esm.json +1 -1
- package/deno.json +1 -1
- package/index.cjs +1 -1
- package/index.cjs.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/node/index.cjs +3 -7
- package/node/index.cjs.map +1 -1
- package/node/index.js +1 -5
- package/node/index.js.map +1 -1
- package/node/metafile-cjs.json +1 -1
- package/node/metafile-esm.json +1 -1
- package/package.json +2 -2
- package/react/index.cjs +90 -1
- package/react/index.cjs.map +1 -1
- package/react/index.js +90 -1
- package/react/index.js.map +1 -1
- package/react/metafile-cjs.json +1 -1
- package/react/metafile-esm.json +1 -1
- package/tests/react/use-document-with-nonexistent-id.test.tsx +11 -28
package/react/metafile-esm.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"inputs":{"src/react/utils.ts":{"bytes":156,"imports":[],"format":"esm"},"src/react/use-document.ts":{"bytes":4064,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/react/utils.ts","kind":"import-statement","original":"./utils.js"}],"format":"esm"},"src/react/use-live-query.ts":{"bytes":1403,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/react/use-all-docs.ts":{"bytes":1021,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/react/use-changes.ts":{"bytes":974,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/react/use-fireproof.ts":{"bytes":
|
1
|
+
{"inputs":{"src/react/utils.ts":{"bytes":156,"imports":[],"format":"esm"},"src/react/use-document.ts":{"bytes":4064,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/react/utils.ts","kind":"import-statement","original":"./utils.js"}],"format":"esm"},"src/react/use-live-query.ts":{"bytes":1403,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/react/use-all-docs.ts":{"bytes":1021,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/react/use-changes.ts":{"bytes":974,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/react/use-fireproof.ts":{"bytes":7004,"imports":[{"path":"@fireproof/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/react/use-document.ts","kind":"import-statement","original":"./use-document.js"},{"path":"src/react/use-live-query.ts","kind":"import-statement","original":"./use-live-query.js"},{"path":"src/react/use-all-docs.ts","kind":"import-statement","original":"./use-all-docs.js"},{"path":"src/react/use-changes.ts","kind":"import-statement","original":"./use-changes.js"}],"format":"esm"},"src/react/types.ts":{"bytes":2407,"imports":[],"format":"esm"},"src/react/img-file.ts":{"bytes":2248,"imports":[{"path":"@fireproof/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/react/index.ts":{"bytes":124,"imports":[{"path":"src/react/use-fireproof.ts","kind":"import-statement","original":"./use-fireproof.js"},{"path":"src/react/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/react/img-file.ts","kind":"import-statement","original":"./img-file.js"}],"format":"esm"}},"outputs":{"dist/fireproof-core/react/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":26069},"dist/fireproof-core/react/index.js":{"imports":[{"path":"@fireproof/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["FireproofCtx","ImgFile","useFireproof"],"entryPoint":"src/react/index.ts","inputs":{"src/react/use-fireproof.ts":{"bytesInOutput":3284},"src/react/use-document.ts":{"bytesInOutput":3369},"src/react/utils.ts":{"bytesInOutput":107},"src/react/use-live-query.ts":{"bytesInOutput":987},"src/react/use-all-docs.ts":{"bytesInOutput":777},"src/react/use-changes.ts":{"bytesInOutput":691},"src/react/index.ts":{"bytesInOutput":0},"src/react/img-file.ts":{"bytesInOutput":1476}},"bytes":11006}}}
|
@@ -48,27 +48,15 @@ describe("HOOK: useDocument with non-existent ID", () => {
|
|
48
48
|
it(
|
49
49
|
"should initialize with the provided _id even if document doesn't exist",
|
50
50
|
async () => {
|
51
|
-
// eslint-disable-next-line no-console
|
52
|
-
console.log("Initial document state:", JSON.stringify(settingsResult.doc));
|
53
|
-
// eslint-disable-next-line no-console
|
54
|
-
console.log("Document state properties:", Object.keys(settingsResult));
|
55
|
-
|
56
51
|
// Try to refresh the document to see if we get the error
|
57
52
|
try {
|
58
|
-
// eslint-disable-next-line no-console
|
59
|
-
console.log("Attempting to refresh document...");
|
60
53
|
await settingsResult.refresh();
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
55
|
+
} catch (_) {
|
56
|
+
// Expected error when document doesn't exist yet
|
64
57
|
}
|
65
58
|
|
66
59
|
await waitFor(() => {
|
67
|
-
// eslint-disable-next-line no-console
|
68
|
-
console.log("After waitFor - document state:", JSON.stringify(settingsResult.doc));
|
69
|
-
// eslint-disable-next-line no-console
|
70
|
-
console.log("After waitFor - document state properties:", Object.keys(settingsResult));
|
71
|
-
|
72
60
|
expect(settingsResult.doc._id).toBe(testId);
|
73
61
|
expect(settingsResult.doc.testField).toBe("test");
|
74
62
|
// Other properties should be undefined
|
@@ -79,26 +67,21 @@ describe("HOOK: useDocument with non-existent ID", () => {
|
|
79
67
|
|
80
68
|
// Try to get the document directly from the database
|
81
69
|
try {
|
82
|
-
// eslint-disable-next-line no-console
|
83
|
-
console.log("Attempting to get document from DB...");
|
84
70
|
const docFromDb = await db.get(testId);
|
85
|
-
//
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
71
|
+
// This should not happen as the document doesn't exist yet
|
72
|
+
expect(docFromDb).toBeUndefined();
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
74
|
+
} catch (_) {
|
75
|
+
// Expected error when document doesn't exist yet
|
90
76
|
}
|
91
77
|
|
92
78
|
// Try to save the document and see what happens
|
93
79
|
try {
|
94
|
-
// eslint-disable-next-line no-console
|
95
|
-
console.log("Attempting to save document...");
|
96
80
|
await settingsResult.save();
|
97
|
-
//
|
98
|
-
console.log("Document saved successfully");
|
81
|
+
// Document should be saved successfully
|
99
82
|
} catch (error) {
|
100
|
-
//
|
101
|
-
|
83
|
+
// This should not happen
|
84
|
+
expect(error).toBeUndefined();
|
102
85
|
}
|
103
86
|
},
|
104
87
|
TEST_TIMEOUT,
|