ArcBees / gwtquery

A jQuery clone for GWT, and much more.
MIT License
85 stars 38 forks source link

GQuery.get(url, data, onsuccess) infitine call (gwtquery 1.4.1) #287

Closed heyarny closed 8 years ago

heyarny commented 10 years ago

The following call is causing an infinite call. Ajax extends GQuery and Ajax.get(...) calls GQuery.get again.. looping until stack overflow.

  public static Promise get(String url, Properties data, final Function onSuccess) {
    return Ajax.get(url, data, onSuccess);
  }

gwtquery 1.4.0 worked fine. I downgraded again.

jDramaix commented 10 years ago

And with gwtQuery 1.4.2 ?

On Mon, May 19, 2014 at 3:51 PM, Arnold notifications@github.com wrote:

The following call is causing an infinite call. Ajax extends GQuery and Ajax.get(...) calls GQuery.get again.. looping until stack overflow. ''' public static Promise get(String url, Properties data, final Function onSuccess) { return Ajax.get(url, data, onSuccess); } '''

gwtquery 1.4.0 worked fine. I downgraded again.

— Reply to this email directly or view it on GitHubhttps://github.com/gwtquery/gwtquery/issues/287 .

heyarny commented 10 years ago

Didn't know 1.4.2 was out. Unfortunately it doesn't work with 1.4.2 as well. 1.4.0 works fine.

manolo commented 10 years ago

Don't use that method it should be deprecated (it has to be fixed though) or removed.

The correct syntax in modern gQuery and jQuery is not to use Function parameters in async implementations like animations or ajax but promises:

GQuery.get(url, data).done(new Function(){}...)

On Mon, May 19, 2014 at 4:03 PM, Arnold notifications@github.com wrote:

Didn't know 1.4.2 was out. Unfortunately it doesn't work with 1.4.2 as well. 1.4.0 works fine.

— Reply to this email directly or view it on GitHubhttps://github.com/gwtquery/gwtquery/issues/287#issuecomment-43507869 .

heyarny commented 10 years ago

GQuery.get(url, data).done(new Function(){}...)

Doesn't exist in 1.4.x?

manolo commented 10 years ago

Sorry Ajax.get instead of GQuery.get

On Mon, May 19, 2014 at 4:22 PM, Arnold notifications@github.com wrote:

GQuery.get(url, data).done(new Function(){}...)

Doesn't exist in 1.4.x?

— Reply to this email directly or view it on GitHubhttps://github.com/gwtquery/gwtquery/issues/287#issuecomment-43510044 .

heyarny commented 10 years ago

Now I get this exception

16:38:38.356 [ERROR] [_****] Uncaught exception escaped
java.lang.Error: Unresolved compilation problem: 
    The constructor PromiseReqBuilder(Ajax.Settings) is undefined
    at com.google.gwt.query.client.plugins.ajax.AjaxTransportJs.getXhr(AjaxTransportJs.java:48)
    at com.google.gwt.query.client.plugins.ajax.Ajax.ajax(Ajax.java:142)
....

My call looks like this:

Ajax.get(href, null).done(new Function() {
                            public void f() {
                            }
                        });

Was the method tested for the release? ;-)

jDramaix commented 10 years ago

Which GQuery version are you using ? I don't see any problem in the code in GwtQuery 1.4.1 and 1.4.2. Are you sure you don't have different version of GQuery in your classpath ?

heyarny commented 10 years ago

I'm using 1.4.2 inside a maven project. Including gquery-dnd-bundle 1.0.6. Don't see any other versions.

heyarny commented 10 years ago

I tried to find the missing constructor inside gquery repository, but it's missing here as well?

jDramaix commented 10 years ago

No it is present : https://github.com/gwtquery/gwtquery/blob/master/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/deferred/PromiseReqBuilder.java#L66

If you are using GwtQuery you cannot include gquery-dnd-bundle because it includes its own version of GQuery. Instead of gquery-dnd-bundle, use the droppable and draggable plugins directly.

heyarny commented 10 years ago

@jDramaix thanks. removing gquery-dnd-bundle didn't help, but I re-arranged the order of dependencies to have gwtquery at the top of all other gwt-like libraries and it started to work.