Comments (9)
We agree an error like this should signaled differently than calling console.error
:
- Calling
onError
would be difficult, because that function takes the active sync session, but at this point no sync session has been established. To call it, we would have to break the API, allowing theonError
to havenull
passed as the sync session argument, which is not ideal. So .. since this error isn't sync specific, we would most likely want to surface it differently than though theonError
. - The
RealmProvider
could take anonError
prop (admittedly, this name might be a little confusing as it conflicts with theonError
passed through thesync
config). - We could throw when the
useRealm
(or any of our other hooks depending on it). - Some other alternative that we haven't thought of? What's an idiomatic way to signal an error state from a React context provider? 🤔
from realm-js.
The RealmProvider could take an onError prop (admittedly, this name might be a little confusing as it conflicts with the onError passed through the sync config).
I would call it onInitializeError
or onRealmInitializeError
as this is something that will only happen during realm initialization?
Or maybe onMountError? but I still prefer the above
We could throw when the useRealm (or any of our other hooks depending on it).
I think this is bad as it is not good to handle error on component renders
from realm-js.
I feel that error boundaries should be used when something unexpectedly happens. A schema error is a handled error and in my opinion, should be handled differently. What we know/is expected should be handled different from the unknow.
But that is only my opinion really. So whatever solutions as long as we can show to our end user it is okay. What we cannot do is swallow the error as it is today as the app just crashes without giving user feedback
from realm-js.
➤ PM Bot commented:
Jira ticket: RJS-2794
from realm-js.
@gfrancischini Thank you for reporting.
I believe that we should extend @realm/react
with an option not to shallow the exceptions from Realm.open()
. We can either rethrow the exception or call the onError
callback (if defined).
from realm-js.
Hey any update on this issue? We are about to enter in homologation with our customer and we would like to be able to correctly log these errors to diagnose possible production problems
from realm-js.
any update on this issue?
Currently we are logging the errors to help customers to diagnose problems. To provide a better solution, we would like the customer to give us feedback on the four items in the previous comment.
from realm-js.
I think this is bad as it is not good to handle error on component renders
I would expect developers to use an error boundary to handle these errors: Via getDerivedStateFromError
on a class-based component or the resuable ErrorBoundary
utility component.
from realm-js.
I suppose the difference is if it's recoverable for the end-user or not 🤔 Some will be, others likely wont. I think this decision is the only thing holding back a fix for this. It's likely a simple change in code - and I'd like for us to get the API right 👍
from realm-js.
Related Issues (20)
- UserProvider doesn't unmount Login-Component HOT 7
- SDKs should not consume stitch_ prefixed fields HOT 1
- Unable to resolve module node:os HOT 5
- Unable to load an existing partition based local database (back of synced realm) to new flexible sync realm HOT 2
- relationships create whole object in realm list instead having reference HOT 1
- Realm app fails to authenticate users when running on Android emulator HOT 1
- Error when building the Android binding with an unexpected NDK HOT 1
- Refactor `ProgressRealmPromise` to register progress notifier only if needed HOT 1
- useObject and reinsertion item HOT 2
- Initializing a named sync Subscription leads to "undefined" HOT 3
- Major Bug: Documents and what library having is different with Listeners HOT 7
- SigSev Android 14 React Native 0.74.1 HOT 1
- Remove `use_frameworks` hack from Podspec HOT 1
- Upgrade to Realm Core v14.9.0 HOT 1
- NPM Always ask to install [email protected] instead of [email protected] ( in package.json ) HOT 2
- Unable to handle a manual client reset due to a missing function HOT 1
- logInWithFacebook is not working with iOS Limited Login HOT 1
- Run bindgen with symbols missing from opt-in list removed HOT 1
- Issue building for ARM/Linux HOT 4
- Inaccurate Return Type for `toJSON` Method in `RealmObject` 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-js.