Skip to content

Updating Parse.LiveQuery to use currentUserAsync. #234

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

Merged
merged 5 commits into from
Apr 11, 2016

Conversation

peterdotjs
Copy link
Contributor

Addressing #232.

@codecov-io
Copy link

Current coverage is 79.84%

Merging #234 into master will increase coverage by +0.04% as of eac5d4b

@@            master    #234   diff @@
======================================
  Files           40      40       
  Stmts         3278    3279     +1
  Branches       775     776     +1
  Methods          0       0       
======================================
+ Hit           2616    2618     +2
+ Partial        230     229     -1
  Missed         432     432       

Review entire Coverage Diff as of eac5d4b

Powered by Codecov. Updated on successful CI builds.

sessionToken = currentUser.getSessionToken();
}
return sessionToken;
let promiseUser = CoreManager.getUserController().currentUserAsync();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is wired to create promiseXXX for each inner promises, why not just chain them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason you want to keep this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the issue here? I thought it's more readable than chaining directly from the above.

@peterdotjs peterdotjs changed the title Updating Parse.LiveQuery to use currentUserAsync. WIP: Updating Parse.LiveQuery to use currentUserAsync. Mar 21, 2016
@yonahforst
Copy link

I tried this out in my react-native app. query.subscribe() now returns a promise and the following example fails:

        let subscription = query.subscribe()
        subscription.on('open', () => {
            console.log('subscription opened');
        });

@peterdotjs
Copy link
Contributor Author

I'm working on changing this to keep the interface the same - when landed .subscribe will return a subscription.

Sent from my iPhone

On Mar 22, 2016, at 7:04 AM, Yonah Forst [email protected] wrote:

I tried this out in my react-native app. query.subscribe() now returns a promise and the following example fails:

    let subscription = query.subscribe()
    subscription.on('open', () => {
        console.log('subscription opened');
    });


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub

@peterdotjs peterdotjs changed the title WIP: Updating Parse.LiveQuery to use currentUserAsync. Updating Parse.LiveQuery to use currentUserAsync. Mar 29, 2016
var liveQueryClient = CoreManager.getLiveQueryController().getDefaultLiveQueryClient();
liveQueryClient.unsubscribe(this);
this.emit('close');
let _this = this;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? I think the arrow function auto bind this for you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arrow does auto bind but in this case we'll need to distinguish between the promise and the subscription context.

@peterdotjs peterdotjs closed this Apr 11, 2016
@peterdotjs peterdotjs reopened this Apr 11, 2016
@peterdotjs peterdotjs merged commit 2e87aa0 into master Apr 11, 2016
@dplewis dplewis deleted the peterjs.liveQueryAsync branch March 21, 2019 14:34
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

Successfully merging this pull request may close these issues.

5 participants