Why does the DatePicker hiding?

Hello friends,

I’ve got a very strange behaviour of DatePicker… It’s hiding. Definetely, the reason is my lack of expierence, but maybe, I hope, it’s something else :slight_smile:

Does anyone have a suggestion what could it be?

Code is below:

public class OrderNameForm extends FormLayout {

    ComboBox<Seller> seller = new ComboBox<>("Seller");
    TextField client = new TextField("Client");
    TextField orderNumber = new TextField("Order Number");
    TextField orderDate = new TextField("Order Date");
    TextField orderDeadLine = new TextField("Order Deadline");
    ComboBox<OrderName.Readiness> orderReadiness = new ComboBox<>("Readiness");
    TextField orderSendDate = new TextField("Order Send Date");

    DatePicker orderDatePicker = new DatePicker("Pick a date");

    Button save = new Button("Save");
    Button close = new Button("Cancel");

    Binder<OrderName> binder = new Binder<>(OrderName.class);
    private OrderName orderName;

    public OrderNameForm(List<Seller> sellers) {
        addClassName("contact-form");

        binder.bindInstanceFields(this);
        orderReadiness.setItems(OrderName.Readiness.values());
        
        orderDatePicker.setLabel("Pick a date");
        orderDatePicker.addValueChangeListener(e -> setOrderDate(e.getValue().toString()));

        seller.setItems(sellers);
        seller.setItemLabelGenerator(Seller::getName);

        add(
                seller, client, orderNumber, orderDatePicker, orderDeadLine, orderSendDate, orderReadiness,
                createButtonsLayout()
        );
    }

    private void setOrderDate(String value) {
        this.orderDate.setValue(value);    }

    public void setOrderName(OrderName orderName) {
        this.orderName = orderName;
        binder.readBean(orderName);
    }

    private Component createButtonsLayout() {
        save.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
        close.addThemeVariants(ButtonVariant.LUMO_TERTIARY);

        save.addClickShortcut(Key.ENTER);
        close.addClickShortcut(Key.ESCAPE);

        save.addClickListener(click -> validateAndSave());
        close.addClickListener(click -> fireEvent(new OrderNameForm.CloseEvent(this)));

        binder.addStatusChangeListener(evt -> save.setEnabled(binder.isValid()));

        return new HorizontalLayout(save,close);
    }

18455352.png

Have you checked your Browser console log? Do you see any errors there at the time page has been first been loaded?

I am asking because, one potential reason could be that there is an error happening during or before DatePicker web component is being registered. And as the component is missing, it cannot be rendered.

Tatu Lund:
Have you checked your Browser console log? Do you see any errors there at the time page has been first been loaded?

I am asking because, one potential reason could be that there is an error happening during or before DatePicker web component is being registered. And as the component is missing, it cannot be rendered.

Unfortunately, there is no error. (Screen in attachment).

Also, I’ve noticed an interesting fact. Before this “hiding thing” it take about 16sec. to start an app, now it’s about 7. Of coarse, I’m glad, that time decreased, but maybe it is somehow related to app behaviour?

18456239.png