[SOLVED] Why does calling a method from within a form submission refresh the entire page?

I have used Methods for several things based on form inputs and it’s worked nicely, so I decided to use it to generate some files via calling a C process at the end of form submission. It all works great - although it has one strange side effect that I cannot prevent - it causes the entire page to refresh.

Is there anyway to prevent this? I have tried adding a return, using await and placing the call inside of a onLoad of the confirmation page also for async execution via a listener - it doesn’t seem to matter where I call the method from it always causes a full page refresh. The strange thing is the other methods I have for purely database code does not do this. It’s only when I run my method that changes files.

My method is defined only in server directory, alongside my publications. I have read on stack overflow that is one cause - definition on the client. So that can be ruled out.

Is this supposed to be like this? Thanks in advance for any help on this. If I cannot figure it in 24 hours I have a work around it just requires alot of coding that would be nice to avoid.

As always, seeing a sample code will help a lot.

And normally, with forms, it is just a simple: e.preventDefault() on the submit function

I have been using e.preventDefault() but in this case it’s on the return of the call.

Form is using:
<AutoForm ref={ref => { fRef = ref; }} onSubmit={data => this.submit(data, fRef)}>


submit(data, formRef) {
  Meteor.call('create', {
        data: this.state
      }, (err, res) => {
        if (err) {
        } else {
          if(res != undefined){

The method is in /server/ and works fine - files are generated but causes a full page refresh:

  'create'({ data }) {
    console.log('Creating file');
    return true; /*added a return to test, doesnt do anything - without a return also causes refresh */


To clarify fully, the page does not do a refresh if you submit the form it’s only if the method is called and on the response from the method (which was successful or an error) it then forces a full page refresh.

1 Like

Any chance that you are triggering the code refresh of Meteor with the new file being created?

1 Like

Ohh of course, if you put a new file in /public it refreshes the entire app in dev mode. Thanks man! I was confused as heck!! Nailed it