addListener notification is empty (documentation only)
See original GitHub issueWhen using addListener(objects, changes) on React Native iOS it always returns empty on the first notification and the second notification returns what should have been in the first one.
I found in results-tests.js below that first notification is empty.
Is this by design or am I doing something wrong here? 😀
realm.objects('TestObject').addListener((testObjects, changes) => {
// TODO: First notification is empty, so perform these
// assertions on the second call. However, there is a race condition
// in React Native, so find a way to do this in a robust way.
//TestCase.assertEqual(testObjects.length, 4);
//TestCase.assertEqual(changes.insertions.length, 1);
resolve();
});
Issue Analytics
- State:
- Created 7 years ago
- Reactions:10
- Comments:27 (5 by maintainers)
Top Results From Across the Web
Cannot read property 'addEventListener' of null - Stack Overflow
I think the easiest approach would be to just check that el is not null before adding an event listener: var el =...
Read more >ServiceWorkerGlobalScope: notificationclick event - Web APIs
This value returns an empty string if the user clicked the notification somewhere other than an action button, or the notification does not...
Read more >SDK Notification Event Handlers - OneSignal Documentation
OneSignal SDK setNotificationOpenedHandler method runs upon opening the app after a notification is clicked. Background Notification Received Event, Native ...
Read more >Scripting API: Events.UnityEvent.AddListener - Unity - Manual
Use this to add a runtime callback. Adding multiple identical listeners results in only a single call being made. //Attach this script to...
Read more >Notifications - Expo Documentation
Custom notification sounds are only supported when using EAS Build, or in the bare ... addEventListener('url', onReceiveURL); // Listen to expo push ...
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 FreeTop 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
Top GitHub Comments
@sheshavpd This was a critical issue for me as well, and for now I got it working by doing
realm.write(() => {})
(basically a second empty write) after each write. Far from ideal and may not be feasible in your context, but it’s been working well for me in the meantime.Realm: 1.12.0 RN: 0.47 Platform: iOS 11 BUT only in simulator - on iPhone SE no problem