Suddenly getting: Cannot render error page for request [/login] and exception

Hi,

i get suddenly the issue: Cannot render error page for request [/login] and exception [Unregistered node was not found based on its id. The tree is most likely corrupted.]

All pages are blank but i cant find any issue or have glue where to start.

Does anyone has a hint where to search?

After removing the “generated” folder and prepeared and build frontend with maven again, it works again. Strange behaviour

But the issue comes back when i override the onAttachMethod in a view

I dont find a working solution. Maybe some one has an idea?

I want to call an external API when the page has been opened. Wanted to make this call in the onAttach method but obviously it doesnt work

Any stacktrace in the server console?

I have no idea for why clearing client-side stuff would have a difference for a Flow view.

Yeah there was a lot of stuff in stack trace but nothing that gave a hint to my view.

Maybe this was an issue with a Spring Bean?

Currently i inject my bean like this, this should be the correct way or is there any better way?

I can try to reproduce the class to the staus when the error came up if that help anyway. But like its now, it works

@AnonymousAllowed
@Route(value = "bookings", layout = MainLayout.class)
public class BookingsView extends VerticalLayout {

    private ApiAdapter apiAdapter;
    Grid<Booking> bookingGrid = new Grid<>(Booking.class, false);

    public RentalMyBookingsView(RentalApiAdapter rentalApiAdapter) {
        this.rentalApiAdapter = rentalApiAdapter;
        createContent();
    }

    @PostConstruct
    void init(){
        bookingGrid.setItems(apiAdapter.getBookings(XYZ));

    }

    private void createContent() {

       //setup grid
        add(bookingGrid);
    }

}

That part looks fine though the @PostConstruct method is probably redundant when you use constructor injection. You could just as well do the initialization directly in the constructor.

I suspect nobody will be able to make any guesses on how to help you without seeing those errors from the console.

When does the View gets constructed? On start up or on Browser Request?

In the previous version of this class the api get called on start up, thats why i put it into PostContruct

Put a breakpoint there and you will find out :slight_smile:. Each user should get their own instance of the view class so the instances should be constructed on demand.

I think @PostConstruct will be run almost immediately after the constructor so that shouldn’t make any difference. But that’s again something you can easily verify in your specific case by setting a breakpoint.