[GH-ISSUE #6] Live data proxy's value not updating when it's being created #4

Closed
opened 2026-05-23 08:36:14 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @appy-one on GitHub (Mar 16, 2021).
Original GitHub issue: https://github.com/appy-one/acebase-core/issues/6

Originally assigned to: @appy-one on GitHub.

If the value of a proxy target did not exist in the database when instantiated (and no default value was given), it is not updated once the database node is created afterwards. This only applies to a created proxy's root value.

To replicate:

// Create proxy without default value
const proxy = await db.ref('chats/chat1').proxy(); 
// proxy.value is now a Proxy whose .valueOf() === null
console.assert(proxy.value.valueOf() === null);

// Create the target
await db.ref('chats/chat1').set({ title: 'New chat' });

// proxy.value now SHOULD be a Proxy whose .valueOf() is the object { title: 'New chat' }
// However, it is still null
console.assert(proxy.value.valueOf() !== null); // Fails assertion

Originally created by @appy-one on GitHub (Mar 16, 2021). Original GitHub issue: https://github.com/appy-one/acebase-core/issues/6 Originally assigned to: @appy-one on GitHub. If the value of a proxy target did not exist in the database when instantiated (and no default value was given), it is not updated once the database node is created afterwards. This only applies to a created proxy's root value. To replicate: ```js // Create proxy without default value const proxy = await db.ref('chats/chat1').proxy(); // proxy.value is now a Proxy whose .valueOf() === null console.assert(proxy.value.valueOf() === null); // Create the target await db.ref('chats/chat1').set({ title: 'New chat' }); // proxy.value now SHOULD be a Proxy whose .valueOf() is the object { title: 'New chat' } // However, it is still null console.assert(proxy.value.valueOf() !== null); // Fails assertion ```
gitea-mirror added the
bug
live data proxy
labels 2026-05-23 08:36:14 -06:00
Author
Owner

@appy-one commented on GitHub (Mar 16, 2021):

Fix published in acebase-core v1.2.3

<!-- gh-comment-id:800187089 --> @appy-one commented on GitHub (Mar 16, 2021): Fix published in acebase-core v1.2.3
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/acebase-core#4
No description provided.