How can I refresh dropdown connected to a reference field?

I have a form that includes a dropdown connected to a reference field (which is connected to the collection ‘Hobbies’).

I have a button in the form that opens a lightbox with a simple form that allows the user to add a new entry to ‘Hobbies.’ I would like to refresh the dropdown in the main form once the user saves the new entry and closes the lightbox. I’ve tried refreshing the dataset in the main form, but nothing happens.

export function openLightboxButton_click(event) {
  wixWindow.openLightbox("Add Hobbies", {
 "name": $w('#nameInput').value
  })
  .then( (data) => {
    $w('#dataset1').refresh()
  });
}

What am I missing?

Maybe you don’t close the lightbox programmatically.

Thanks for your reply, @jonatandor35

I’m closing it programmatically.

I tried something else from my previous example and it is still not working. Here it is.

LIGHTBOX

import wixWindow from 'wix-window';

var inputsave

$w.onReady(function () {
 let received = wixWindow.lightbox.getContext();
    $w('#interestsDropdown').value = received.interests;
    $w('#dataset1').onBeforeSave(() => {
        inputsave = $w('#hobbiesInput').value;
    })
});

export function closeButton_click(event) {
    wixWindow.lightbox.close(inputsave);
}

MAIN FORM

export function openLightboxButton_click(event) {
  wixWindow.openLightbox("Add Hobbies", {
     "interests": $w('#interestsDropdown').value
  })
  .then( (data) => {
    $w('#dataset1').refresh((data) => {
      $w('#hobbiesDropdown').value = data;
    });
  });
}