Check out this code snippet:
let order_modal = document.getElementById('order');
order_modal.addEventListener('show.bs.modal', function (e) {
bootstrap.Modal.getInstance(order_modal).hide();
}, false);
Upon opening the modal, the .hide() method does not function as expected.
Switching the event to 'shown.bs.modal' resolves the issue, however the modal flashes.