Skip to content

UIBinder ui:style fails when first omitted #10329

@craigmit

Description

@craigmit

Issue: Adding a ui:style after not having one in the UIBinder causes a crash.

To reproduce:

  1. Clone my demo repo: git clone https://github.com/craigmit/GwtUiBinderStyleIssue.git
  2. cd GwtUiBinderStyleIssue
  3. Start code server: mvn gwt:codeserver -pl *-client -am
  4. Start server: mvn spring-boot:run -pl *-server -am
  5. Visit page: http://localhost:8080/
  6. You should see a page saying "No style"
  7. Edit: test-client/src/main/java/test/TestWidget.ui.xml
  8. Remove the comments, so it now looks like this:
Image
  1. Refresh the page: http://localhost:8080/

The page crashes with:

Uncaught TypeError: this.get_clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay_0_g$(...).style_3_g$ is not a function
    at C3d_g$.F7d_g$ [as build_style_0_g$] (TestWidget_TestWidgetUiBinderImpl.java:72:1)
    at new C3d_g$ (TestWidget_TestWidgetUiBinderImpl.java:43:1)
    at w3d_g$.y3d_g$ [as createAndBindUi_1_g$] (TestWidget_TestWidgetUiBinderImpl.java:31:1)
    at w3d_g$.x3d_g$ [as createAndBindUi_0_g$] (TestWidget_TestWidgetUiBinderImpl.java:28:1)
    at new s3d_g$ (TestWidget.java:13:1)
    at o3d_g$.p3d_g$ [as onModuleLoad_0_g$] (App.java:14:1)
    at Array.J1b_g$ (test_00046App__EntryMethodHolder.java:3:1)
    at initializeModules_0_g$ (ModuleUtils.java:44:1)
    at Hp_g$ (Impl.java:293:1)
    at Kp_g$ (Impl.java:352:1)

Even if you stop everything, mvn clean, and start it back up, it still crashes.

Workaround:
The only way I've found to get it to work is to remove the style so it looks like this:

Image

Refresh the page. Now you see the page without the style:

Got style, ayyyy!
No style

Then add the style back in (so it looks like step 8 above), and it now works:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions