llaske / ExerciserReact

React code of Exerciser Activity. GSoC 2018
Apache License 2.0
15 stars 49 forks source link

Lib update and Indentation fix #84

Closed AvinashAgarwal14 closed 5 years ago

llaske commented 5 years ago

I've got a debugger stop when I'm trying to run in Android or when I'm running the activity from file:/// (basically, because we're using Cordova, running on Android means running in file:///).

image

The error is: TypeError: Failed to register a ServiceWorker: The URL protocol of the current origin ('file://') is not supported. Is there some restriction to use ReactJS on file:/// ? @thingthing any idea?

Look like this error is not new (tested on the previous version of Exerciser).

llaske commented 5 years ago

Can't build the app, look like there is a missing module/directory:

Module not found: Error: Can't resolve './media/defaultExerciseThumbnail/videos' in '/home/lionel/src/olpc/ExerciserReact/src'

llaske commented 5 years ago

The thumbnail update is possible but if you change something (crop, rotate, flip, ...) and cancel your change, there is now an error message in the console:

Uncaught TypeError: A.props.onClose is not a function
    at onClick (ImageEditor.js:218)
    at Object.n (react-dom.production.min.js:15)
    at Object.invokeGuardedCallback (react-dom.production.min.js:16)
    at Object.invokeGuardedCallbackAndCatchFirstError (react-dom.production.min.js:16)
    at c (react-dom.production.min.js:20)
    at l (react-dom.production.min.js:22)
    at w (react-dom.production.min.js:22)
    at Q (react-dom.production.min.js:21)
    at u (react-dom.production.min.js:24)
    at E (react-dom.production.min.js:24)
onClick @ ImageEditor.js:218
n @ react-dom.production.min.js:15
invokeGuardedCallback @ react-dom.production.min.js:16
invokeGuardedCallbackAndCatchFirstError @ react-dom.production.min.js:16
c @ react-dom.production.min.js:20
l @ react-dom.production.min.js:22
w @ react-dom.production.min.js:22
Q @ react-dom.production.min.js:21
u @ react-dom.production.min.js:24
E @ react-dom.production.min.js:24
PA @ react-dom.production.min.js:88
wt @ react-dom.production.min.js:221
q @ react-dom.production.min.js:44
WA @ react-dom.production.min.js:89
interactiveUpdates @ react-dom.production.min.js:225
ZA @ react-dom.production.min.js:89

The error appears also on other editor usage (not only in thumbnail)

thingthing commented 5 years ago

I've got a debugger stop when I'm trying to run in Android or when I'm running the activity from file:/// (basically, because we're using Cordova, running on Android means running in file:///).

image

The error is: TypeError: Failed to register a ServiceWorker: The URL protocol of the current origin ('file://') is not supported. Is there some restriction to use ReactJS on file:/// ? @thingthing any idea?

Look like this error is not new (tested on the previous version of Exerciser).

You can perfectly disable the serviceworker if you want. To do it, in the file index.js, you can

// import registerServiceWorker from './registerServiceWorker';
import { unregister } from registerServiceWorker;
...
// registerServiceWorker();
unregister();

This will make sure to clean all serviceWorker that were previously registered if any were, if not, it will just do nothing.

llaske commented 5 years ago

Thanks @thingthing, @AvinashAgarwal14 could you try to remove the Service Worker and test if everything works fine without it? In fact, I'm not sure at all that Service Worker features of offline handling comes from free. I mean, if you don't explicitly use it, caching will not happen automatically in the background. So, if there is no use of Service Worker features in the current code of Exerciser, I guess we could disable it without risk.

llaske commented 5 years ago

Nice job.