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

Application.RenderToString hangs when fetch result returns the value false. #376

Closed
goldensunliu opened this issue Aug 31, 2015 · 1 comment · Fixed by goldensunliu/marty-lib#1 · May be fixed by martyjs/marty-lib#30
Closed

Comments

@goldensunliu
Copy link

class UsersStore extends Marty.Store {
  isCurrentUserAdmin(){
    return this.fetch({
      id: 'isCurrentUserAdmin' ,
      locally() {
        return this.state.isCurrentUserAdmin;
      },
      remotely() {
        return this.app.userQueries.isCurrentUserAdmin();
      }
    });
  }
}

is this example assume state.isCurrentUserAdmin assigned to true or false in the state UsersStore. When using it on the server side via Application.RenderToString the rendering hangs until max number of tries are reached and returns the string. The fetch remains pending throughout the iterations.

example diagnostic

  { status: 'PENDING',
    storeId: 'stores.UsersStore',
    fetchId: 'isCurrentUserAdmin',
    time: 121 }

  { status: 'PENDING',
    storeId: 'stores.UsersStore',
    fetchId: 'isCurrentUserAdmin',
    time: 1121 }

  { status: 'PENDING',
    storeId: 'stores.UsersStore',
    fetchId: 'isCurrentUserAdmin',
    time: 2121 }

it has to do with https://github.com/martyjs/marty-lib/blob/master/src/store/storeFetch.js#L153
where a statement trying to check existence of var result doesn't check for when result === false

@goldensunliu
Copy link
Author

#375 (comment)

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