Comments (7)
➤ PM Bot commented:
Jira ticket: RDART-970
from realm-dart.
This line looks odd:
const Uuid().v4(),
Are you using the uuid
package? Realm come bundled with sane_uuid
. If you use that instead, you can also use Uuid
instead of String
as primary key on $PlayerCredit
.
My bet would be that some code-path is removing the player credit from the match again later.
The transaction guarantees that credit
is added to match.playerCredits
or not added to the realm at all, at the end of that transaction. Actually you don't need realm.add(credit);
as that is implied by match.playersCredits.add(credit);
What happens after I cannot attest to.
from realm-dart.
Are there any errors in the server logs related to the match or the credit document? I'm wondering if it's possible that the player credit got removed from the match either due to a validation error or due to a change somewhere.
Another thing to consider is whether you want the PlayerCredit
object to be an embedded object - that is, it won't be able to exist independently of a parent. In json, that would be represented as a nested object/document. That way the entire playerCredits
collection will be contained in the match.
from realm-dart.
Are there any errors in the server logs related to the match or the credit document? I'm wondering if it's possible that the player credit got removed from the match either due to a validation error or due to a change somewhere.
I got no error for this, both on server and Sentry.
Are you using the
uuid
package? Realm come bundled withsane_uuid
. If you use that instead, you can also useUuid
instead ofString
as primary key on$PlayerCredit
.
I do use uuid
, but I don't think it's related. I started using it before realm
so I kept it.
My bet would be that some code-path is removing the player credit from the match again later.
I do remove it somewhere in my code, but it's too in an transaction.
I agree I assumed that my problem came from the add function, but it may come from this one when I remove it.
Here the code :
final credits = match.playersCredits.where((element) => element.player?.id == oldPlayer.id).toList();
if (credits.isNotEmpty) {
match.playersCredits.removeWhere((element) => element.player?.id == oldPlayer.id);
realm.deleteMany(credits);
}
await transaction.commitAsync();
await realm.syncSession.waitForUpload();
The transaction guarantees that
credit
is added tomatch.playerCredits
or not added to the realm at all, at the end of that transaction.
I agree that since in transaction it should be ok.
Actually you don't need
realm.add(credit);
as that is implied bymatch.playersCredits.add(credit);
What happens after I cannot attest to.
Oh I didn't know about this, thanks for the tip !
from realm-dart.
If you're able to reproduce this while collecting trace level logs on the client, that would help a lot to try and identify the root cause.
from realm-dart.
Unfortunately, I never managed to get any log on this issue.
I posted here more in hope that you know about some issue like a race condition on array or anything that may be linked to this.
If u don't, I think I will just re-design this part to avoid this problem !
from realm-dart.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
from realm-dart.
Related Issues (20)
- Flutter Build Issue MacOS - Invalid Code Signing Entitlements (while uploading to Testflight) HOT 15
- realm.Open() not responding HOT 11
- Generated RealmObject classes have incorrect names for embedded objects when using two leading underscores HOT 1
- Update realm-core to v14.7.0 HOT 2
- Add To Map/Json HOT 7
- Realm error : could not open librealm_dart.so on Android 86 HOT 9
- Can Realm be called inside native code? HOT 3
- Avoid using Finalizable on anything but handles HOT 1
- Drop catalyst support HOT 2
- Build and test for Windows ARM HOT 1
- Build and test for Linux ARM HOT 1
- Refactor native platform specific code HOT 1
- Fix Flutter iOS test issue ("Too many open files"), when run on simulator on macos-14 HOT 1
- Make auto download and install during builds optional HOT 3
- Generate file in folder HOT 1
- MultipleSyncAgents: Multiple sync agents attempted to join the same session HOT 15
- Sync support for Nested maps. HOT 8
- Can't open Realm in tests. HOT 4
- Update realm-core to v14.9.0 HOT 1
- Unexpected document sync behaviour when realm is opened HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realm-dart.