Issue in inserting rows in GridLayout

I am facing an issue using GridLayout. I have a need to insert rows in the GridLayout dynamically. However this fails with an Uncaught client side exception.
Code snippet below:


    public void testVaadinGrid() {
        final GridLayout gridLayout = new GridLayout();
        gridLayout.insertRow(0);
        gridLayout.addComponent(new Label("Grid 1"), 0, 0);

        Button button = new Button("show field in grid");
        button.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                gridLayout.insertRow(0);
                gridLayout.addComponent(new Label("Grid 2"), 0, 0);
            }
        });
        addComponent(button);
        addComponent(gridLayout);
    }

Anyone faced this issue before and is there a work around?

This is most likely caused by
http://dev.vaadin.com/ticket/10324
.