Skip to content

Commit

Permalink
Add comment on last active upload logic
Browse files Browse the repository at this point in the history
  • Loading branch information
peterszerzo committed Oct 25, 2024
1 parent 49a4eff commit 0f99847
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/chat-widget/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@ const isInputDisabled = (responses: Response[]): boolean => {
return new URLSearchParams(payload).get("nlx:input-disabled") === "true";
};

/**
* IMPORTANT: upload state will get wiped out if there is a newer bot response comes in with different upload configuration.
* This is generally the way conversations are intended to work (choice buttons also do not work by default after new messages come in),
* and it's worth keeping these limitations in mind when designing/maintaining state management.
*/
const findActiveUpload = (responses: Response[]): UploadUrl | null => {
const lastBotResponse = findLast(
(response): response is BotResponse => response.type === "bot",
Expand Down

0 comments on commit 0f99847

Please sign in to comment.