Populated records not updating in realtime
See original GitHub issueAre records populated on the feathers server supposed to publish changes to clients in realtime?
Say we have a user with populated contacts as so:
// server (in schema)
User = {
contacts: [ User ] // populated in hook
}
// client (in model)
setupInstance(data, { models, store }) {
const { User } = models.api
if (data.contacts) {
data.contacts = data.contacts.map(contact => new User(contact))
}
return data
}
If one of the populated users were to change its name remotely from its own account, would it be reflected live to the others? Or does the model assignment in setupInstance only serves as a means to save the user back to its own service?
I didn’t manage to make the live connection work with populated records. It only works when get/finding the services directly. Please tell me if this is expected behavior.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:25 (13 by maintainers)
Top Results From Across the Web
How to Update millions or records in a table - Ask TOM
With nologging, if the system aborts, you simply re-run the 'update' again, as you have the original data in the main table. When...
Read more >Solved: Code not updating records - ServiceNow Community
Hello,. I have a background script that does not seem to be working. It is supposed to copy all field values from 1...
Read more >Are Views automatically updated - sql - Stack Overflow
Yes, they are updated, every time you use them. I think Microsoft sums up what a View is quite clearly: A view can...
Read more >UPDATE RECORD ELEMENT In Salesforce Flow - YouTube
In this video, I'm explaining the update record element to learn how we can update records in Salesforce Flow.
Read more >Why is the DNS Server not updating with dynamic updates ...
Most often when I see this kind of DHCP-not-updating DNS behavior, it is because the credentials that DHCP uses to do the updates...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for your input @J3m5. You’re right, getting the contacts directly from the store is a solution (although we still have to filter out the main user + other users that might have been independently loaded to the store).
Another workaround would be to fetch the relationships separately from the client, as shown in the guide’s example where a patient record first gets loaded, then its appointments.
Still, it seems having the populated records react directly through the nested relationships would be a more elegant and convenient way to do it.
I did something similar 6 months ago.
And I define relttionships in he Model like that: