Coder Social home page Coder Social logo

Error shown to user (and fetch call cancelled) if onAppointmentSend event execution happens when other launch event(s) are running on an appointment about office-js HOT 6 OPEN

pepso avatar pepso commented on August 10, 2024
Error shown to user (and fetch call cancelled) if onAppointmentSend event execution happens when other launch event(s) are running on an appointment

from office-js.

Comments (6)

pepso avatar pepso commented on August 10, 2024

After further thinking the issue there's another way of looking at this non-descriptive error message:

Calling event.completed({allowEvent: false, errorMessage: 'This meeting is…', commandId: 'openPanel', cancelLabel: 'Custom Label'} renders the errorMessage when the onAppointmentSend is the only launch event being executed.

On the other hand, if there are other launch events being executed, the completed function's errorMessage does not get rendered to the warning dialog for the user (and ongoing fetch call gets cancelled).

from office-js.

rkpathak avatar rkpathak commented on August 10, 2024

@pepso It's not clear what API call you are making that is getting cancelled and from which event handler. Can you give clear steps that we can follow to reproduce this issue. Or share sample addin code/script lab code link that we can use to reproduce the issue.

from office-js.

pepso avatar pepso commented on August 10, 2024

Hi @rkpathak,

While I was compiling you a minimum failing example it started to look like the network error is not the culprit, but a symptom on how the action sequencing are handled (and how they fail).

When running below example do these steps on the New Outlook UI:

  1. Open an existing event in edit mode
  2. Trigger launch event(s) with "All day" toggle
  3. Click send (within 100's of milliseconds from the toggle)
  4. Observe dialog error text "Add in is preventing this email from being sent." (ERROR)
  5. Close the dialog
  6. Wait a couple of seconds and click send
  7. Observe dialog error text "Show custom error message." (OK)
  8. Comment out the row 15, fake network delay from the sendAction
  9. Trigger launch event(s) with "All day" toggle
  10. Click send (within 100's of milliseconds from the toggle)
  11. Observe dialog error text "Show custom error message." (OK)
            <LaunchEvents>
              <LaunchEvent Type="OnAppointmentSend" FunctionName="sendAction" SendMode="PromptUser" />
              <LaunchEvent Type="OnNewAppointmentOrganizer" FunctionName="action"/>
              <LaunchEvent Type="OnAppointmentAttachmentsChanged" FunctionName="action" />
              <LaunchEvent Type="OnAppointmentAttendeesChanged" FunctionName="action" />
              <LaunchEvent Type="OnAppointmentTimeChanged" FunctionName="action" />
              <LaunchEvent Type="OnAppointmentRecurrenceChanged" FunctionName="action" />
              <LaunchEvent Type="OnAppointmentOrganizer" FunctionName="action" />
            </LaunchEvents>

And here's the code of commands.js:

Office.onReady(() => {});

function fakeNetworkCallDelay(millisec) { 
  return new Promise(resolve => { 
      setTimeout(() => { resolve('') }, millisec); 
  }) 
}

const action = async(event) => {
  await fakeNetworkCallDelay(500);
  event.completed();
}

const sendAction = async(event) => {
  await fakeNetworkCallDelay(2000); // If you comment this row out, you get the "Show custom error message" message on the dialog popup.
  event.completed({"allowEvent":false,"errorMessage":"Show custom error message."});
}

window.action = action;
window.sendAction = sendAction;

from office-js.

kumarshrey-msft avatar kumarshrey-msft commented on August 10, 2024

Hi @pepso, can you please confirm whether you are having multiple launch event add-ins?

from office-js.

pepso avatar pepso commented on August 10, 2024

@kumarshrey-msft when I ran the tests I had 2 launch event add-ins (or maybe 3 when you count the side-loaded add-in). It is my belief the client who reported the error to us originally has only our Add-in running with launch events.

from office-js.

exextoc avatar exextoc commented on August 10, 2024

@pepso Thanks for reporting this issue, we have been able to reproduce it and it has been put on our backlog. We unfortunately have no timelines to share at this point.

Internal tracking id: Office: [292838]

from office-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.