veliovgroup / ostrio-Neo4jreactivity

Meteor.js Neo4j database reactivity layer
https://atmospherejs.com/ostrio/neo4jreactivity
BSD 3-Clause "New" or "Revised" License
51 stars 5 forks source link

Setting allowClientQuery to false causes dependencies not to update #15

Closed pvmeijel closed 9 years ago

pvmeijel commented 9 years ago

The "About Security" section of the documentation seems to imply that allowClientQuery should be set to false in a production environment: "By default query execution is allowed only on server, but for development purpose (or any other), you may enable it on client.".

I thought that by setting allowClientQuery = false, the client calls a Meteor.neo4j method on the server. The server, in turn, executes the query and returns the data. Using a helper function, the data is made available to the template. So I created the following helper:

if (Meteor.isClient) {
    Template.projectsList.helpers({

        projects: function(){
            Meteor.neo4j.call('getProjects', {}, function(error,data){
                Session.set('projects', data.get());
            });
            return Session.get('projects');
        }
    });
}

if(Meteor.isServer){    
    Meteor.neo4j.methods({
            'getProjects': function(){
                return 'MATCH (p:Project) RETURN p';
            }
    });
}

Now I reset meteor with

meteor reset
meteor

When I load the page now, no data appears. When I hit the refresh button in my browser to reload the page, data does show up. So it seems that settings allowClientQuery causes the dependencies not to update. Did I misunderstand what allowClientQuery = false means, or is there some bug in the package?

dr-dimitru commented 9 years ago

@pvmeijel the allowClientQuery property only prevent direct client queries to Neo4j. But it allows to continue execute queries via methods , like Meteor.neo4j.methods and Meteor.methods

Issue which you describe:

When I load the page now, no data appears. When I hit the refresh button in my browser to reload the page, data does show up.

will be fixed in next release - very soon

dr-dimitru commented 9 years ago

@pvmeijel fixed in: https://github.com/VeliovGroup/ostrio-Neo4jreactivity/commit/3ca874c490bd51c6f39010727a8190a50e09969e