Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: Realtime not triggering document updates on parent for removals of association #6265

Open
2 tasks done
ndizazzo opened this issue Sep 16, 2023 · 3 comments
Open
2 tasks done
Assignees
Labels
bug Something isn't working feature / relationships Fixes and upgrades for database relationships

Comments

@ndizazzo
Copy link

ndizazzo commented Sep 16, 2023

👟 Reproduction steps

Setup

  1. Create two collections: Assembly & Part (or whatever you like)
  2. Create a two-way parent-child relationship between the collections. Inside Assembly:
    i. Attribute Key: parts
    ii. Attribute Key (related collection): assembly
    iii. Relation: one-to-many
    iv. Ensure to set the "on delete" behaviour to "Set document id to NULL in all related documents"
  3. Write some code using the web SDK to subscribe to the documents channel for the Assembly collection only (databases.*.collections.assembly.documents)

Testing

  1. Use createDocument in the SDK to create an Assembly
  2. Use updateDocument in the SDK on the Assembly created above to add a new Part document, which creates the association for you
  3. Observe that the promise for the Assembly is called (as expected) when the association was created
  4. Observe in the Appwrite UI that the documents exist and have the data provided
  5. Now, use deleteDocument in the SDK on the Part above, to remove the part and the association from Assembly
  6. Observe that the promise for the Assembly is not called
  7. Observe in the Appwrite UI that the Part no longer exists and the association in Assembly is gone

👍 Expected behavior

✅ Real-time should send a payload update for Assembly when the association is created
✅ Real-time should send a payload update for Assembly when the association is deleted

👎 Actual Behavior

✅ Real-time should send a payload update for Assembly when the association is created
❌ Real-time should send a payload update for Assembly when the association is deleted

🎲 Appwrite version

Version 1.4.x

💻 Operating system

Linux

🧱 Your Environment

Appwrite is self-hosted with docker-compose in a virual machine on Ubuntu 22.04.

Appwrite Version: 1.4.1
Appwrite SDK: web

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@ndizazzo ndizazzo added the bug Something isn't working label Sep 16, 2023
@ndizazzo
Copy link
Author

For those who might be searching issues for something similar, a workaround I've devised is to add a Datetime field named touch on the parent object (in this case, Assembly) that I also update to be a new Date() immediately after removing associations.

This isn't ideal, but allows me to receive the updated parent object with the association removed as I'd expect.

@Haimantika Haimantika added the feature / relationships Fixes and upgrades for database relationships label Sep 18, 2023
@Haimantika
Copy link
Contributor

Thanks @ndizazzo for raising the issue and also posting the work around. Tagging @abnegate to look into this.

@ishmeet5ingh
Copy link

is there any solution for this bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature / relationships Fixes and upgrades for database relationships
Projects
None yet
Development

No branches or pull requests

4 participants