Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with NativeScript 6 #268

Open
edselg opened this issue Sep 29, 2019 · 5 comments
Open

Compatibility with NativeScript 6 #268

edselg opened this issue Sep 29, 2019 · 5 comments
Assignees

Comments

@edselg
Copy link
Contributor

edselg commented Sep 29, 2019

Using the JSDO with NativeScript 6 fails with an error like the following:

CONSOLE LOG file:///app/tns_modules/@angular/core/bundles/core.umd.js:25776:18: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
LOG from device E’s iPad: CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:4160:24: ERROR Error: Uncaught (in promise): TypeError: null is not an object (evaluating 'object.result')
sessionRejectHandler(file:///app/vendor.js:13477:39)
at getSession(file:///app/vendor.js:13645:33)
at createSession(file:///app/0.819c957f9e93e0b2b6d0.hot-update.js:32:85)
at HomeComponent(file:///app/0.819c957f9e93e0b2b6d0.hot-update.js:21:27)

image

Steps to reproduce

  1. Create project using the following command:
    tns create testapp --template tns-template-master-detail-progress-ng
  2. Run the project using Preview:
    tns preview

Related links:

Research shows that this issue is caused by deprecation of the nativescript-localstorage plugin which is a dependency.
A solution for this issue is use the LocalStorageEmulation implemented a while back to work Node.js. Once the localStorage and sessionStorage references in progress-util.js point to the LocalStorageEmulation component, the project runs successfully.

@edselg edselg self-assigned this Dec 18, 2019
@mikefechner
Copy link

@edselg hope you're doing fine! Is there any estimate when this issue will be solved?

@steinerj
Copy link

steinerj commented Apr 3, 2020

For a sample implementation of the in-memory-emulation check out: https://github.com/steinerj/jsdo-kinvey-flex

This is a project targeting nodejs. It's using the core JSDO and globally overwrites "sessionStorage" with the in-memory emulation. This might not work in TypeScript projects w/o overriding some TS settings. It might also not be the most sound approach in general :)
An alternative to this is forking the jsdo core and place the emulation directly in there.

Nice effect: no file or sqlite I/O is performed and it's thus marginally faster than the original implementation :)

NB: I believe for NativeScript the XHR emulation used in the project is not necessary, since NativeScript provides it's own XHR emulation.

@mikefechner
Copy link

Thanks, @steinerj

@edselg
Copy link
Contributor Author

edselg commented Apr 3, 2020

@mikefechner

I am well. I hope you are doing well too.

We currently do not have an estimate on when a fix for this issue would be publicly available.

How is this issue impacting you?

If you are interested, I can provide the fix via a Git branch.

Please let me know.

Thanks.

@mikefechner
Copy link

All is well on this end too!

We are currently implementing a fix in our JSDO fork. So looking at your fix might be great to confirm what we are doing.

Cheers,

Mike

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants