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)
- Custom paths do not work when using sync HOT 1
- Data Loss in Nested Objects When Using Spread Operator for Update in Realm JS HOT 6
- Test helper waitForConnectionState is not doing anything HOT 1
- Provide defaults for `useUser()`'s generic type parameters HOT 2
- > I completely forgot I had opened this issue. I did manage to fix this back in the day but forgot to update... Back then I seemed to be the only one in the whole world with this problem :P HOT 4
- Generate SRI hash for our `realm-web` IIFE bundle HOT 1
- Revisit our workaround for flushing the microtask queue after calls from C++ into JS HOT 1
- RN event loop stuck when using realm with an expo development build HOT 9
- Refactor throwing uncaught exceptions from callbacks dispatched onto the event loop from C++ HOT 1
- Error: Realm at path *** already opened with a different schema mode in React Native HOT 4
- Package path . is not exported from package HOT 5
- 'object type 'f' not found in schema' occurs when updating the application via code push appcenter HOT 4
- Remapped Property Key Not Working with Sorting HOT 1
- Keep login information persistent with 12.0.0-browser.2 HOT 3
- toJSON() serialization of BSON.ObjectId to String HOT 1
- `@realm/react`: Passing an app as a prop to `AppProvider` HOT 1
- Error: Database has an unsupported version (24) and cannot be upgraded HOT 2
- Gradle lint error with 12.10.0 and yarn errors with 12.11.1 HOT 4
- Unable to resolve "../../../realm/lib/browser$1" from "node_modules/@realm/react/dist/index.cjs" HOT 3
- Sync protocol version issue in 12.0.0-browser.2 HOT 3
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.