-
-
Notifications
You must be signed in to change notification settings - Fork 597
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
Local Datastore #612
Local Datastore #612
Conversation
Codecov Report
@@ Coverage Diff @@
## master #612 +/- ##
==========================================
+ Coverage 85.69% 88.57% +2.88%
==========================================
Files 48 53 +5
Lines 3928 4535 +607
Branches 898 1052 +154
==========================================
+ Hits 3366 4017 +651
+ Misses 562 518 -44
Continue to review full report at Codecov.
|
@flovilmart Can you check Travis for me? I've been having gulp issues. Also can you do a quick run though of what I've done so far? Its pretty close to being done. |
Error: Cannot find module 'utf-8-validate' from '/home/travis/build/parse-community/Parse-SDK-JS/node_modules/parse/node_modules/ws/lib' It’s the error that I see before the integration tests, during the browserify build |
@flovilmart I got both Error: Cannot find module 'utf-8-validate' from 'xxx/node_modules/ws/lib' I tried to npm install --save them but ended up with another error |
Uhm, that’s odd, try reverting ws to an earlier version then :) |
@flovilmart I fixed the issue. It was a lot of circular dependency. Since localStorage isn't available I'll have to mock it along with some other tests. Can you have a quick look through? |
I’ll have a look. The diff hit for coverage is only 21.11% can we do something? |
@flovilmart I'll try |
src/LocalDatastore.js
Outdated
@@ -41,29 +40,30 @@ const LocalDatastore = { | |||
controller.clear(); | |||
}, | |||
|
|||
_handlePinWithName(name: string, object: ParseObject) { | |||
_handlePinWithName(name: string, object: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why loose the typing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept running into a
Uncaught TypeError: Super expression must either be null or a function, not undefined
Whenever I used ParseObject in the tests. I found a fix for it so I'll add the typing back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are 💯
I’ll review over the weekend |
integration/test/ParseQueryTest.js
Outdated
}); | ||
}); | ||
|
||
describe('Parse Query Pinning (LocalStorage)', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flovilmart Quick question? Since I have both in-memory and localStorage available. I want to run the test cases against both without copying them. Would putting describe
inside of a for-loop make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep it works, otherwise what you can do is put it into a functions and call the function from the specific describe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried putting it in a loop. It also works great with Jasmine Test Explorer too
@flovilmart @acinader Quick Update Since objects have serverData some of the querying from LDS may not work as intended
|
improve coverage and clean up unused code
@dplewis thanks! I'll have a look! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've read through it all. This looks good to me and I can see it much requested.
Do you think this would be useful in node? cloud code?
Could be helpful at this point to make a draft section to go in the guide? I'd be glad to help edit and that could help me try this out too? |
@acinader I opened a PR in the docs repo parse-community/docs#558 |
man, that's seriously helpful. I have barely touched the IOS SDK, so this makes more sense now. |
Where do we stand on this one? |
It should be good to go! |
Is it completely opt-in? And anyone not wanting the feature should be able to experience no regression? |
Yes you have to enable it with |
I’ll give a good read and let you merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s see how it goes!
Hello guys does updating an object while being offline, get sync automatically when network access reappear with this new feature (react-native usage) ? Can't wait to test the localstorage feature with the upcoming 2.2.0 release 🤩 |
It currently doesn't exist. Thats something we can implement in the future. I want to play around with this in production for a bit. Feel free to open a PR. |
Ok so if I understand correctly this version smoothly enable offline read access to already sync datas. |
@dplewis is the following doc regarding localstorage (parse-community/docs#558) up to date with the last 2.2.0 release ? |
Yes, I also opened a PR to address your sync feature. Waiting for 2.2.0 to be release to npm |
Great I will have a look at your pull request #734 when I have time! |
This is based on discussion #77
This is a Work In Progress.