keval shah ac654b2e71 fix(frontend): preserve IME composition for dead-key accents (#12801)
* fix(frontend): preserve IME composition for dead-key accents in inputs

Dead-key accents (macOS Option+e, Linux dead keys, CJK IME) were dropped in
node inputs because the store update cascade (100-200ms per keystroke) plus
a `setSelectionRange` call on every `value` change aborted browser IME
composition. Typing `Option+e a` landed as `´a` instead of `á`.

Introduce a shared `useIMEInput` hook that keeps a local `displayValue`
mirror so React's controlled value always matches the DOM, defers `onCommit`
until `compositionend`, NFC-normalizes the composed string, and guards the
cursor-restore effect while composing.

Wire the hook into `InputComponent` (form branch extracted to
`FormInputBranch` so the hook is only mounted when active),
`CustomInputPopover`, `CustomInputPopoverObject` (gated on text-entry mode
so selection-mode renders stay read-only), `CursorInput`, and
`TextAreaComponent`.

* test(frontend): add adversarial IME tests and tighten popoverObject guards

Address code-review feedback on the dead-key accent fix:

- Extract `useIMEInputForOnChange` helper so popover, popoverObject, and
  cursor-input stop duplicating cursor state + commitValue wiring.
- Export `normalizeNFC` from the hook and reuse it in `TextAreaComponent`'s
  modal setValue instead of duplicating the branch inline.
- Null-guard `options?.find`, `(selectedOptions ?? []).map`, and the
  CommandList `options ?? []` so `CustomInputPopoverObject` no longer
  crashes when selection-mode flags toggle before data props populate.
- Coerce `readOnly` to a boolean to avoid passing a function reference.
- Add adversarial tests that cover:
  - null/undefined `value` prop (hook fallback).
  - orphan `compositionstart` without `compositionend`.
  - multiple `compositionstart` before a single `compositionend`.
  - null `selectionStart` on `compositionend`.
  - absent `String.prototype.normalize` fallback.
  - parent rerenders mid-composition — `onCommit` stays suppressed.
  - `FormInputBranch` folder-rename synth event (idle + IME paths).
  - `CursorInput` ref forwarding for both function and object refs.
  - `CustomInputPopoverObject` selection-mode gating + null-guard paths.

Coverage on the fix surface: `use-ime-input.ts` 100% stmts / 93.1% branch,
`popoverObject/index.tsx` 86.6% stmts / 89.4% branch, `cursor-input.tsx`
100% stmts / 73.3% branch.

* [autofix.ci] apply automated fixes

* fix(frontend): flush IME composition on blur and unmount

Address review feedback on the dead-key accent fix (#9096):

- Add `flushPendingComposition` to `useIMEInput` so blur-mid-composition
  (macOS dead keys, Safari/WebKit) commits the composed buffer instead
  of dropping it and leaving the field stuck in composing mode. Wire
  into all 5 call sites: `InputComponent`, `CustomInputPopover`,
  `CustomInputPopoverObject`, `CursorInput`, `TextAreaComponent`.

- Add unmount-cleanup `useEffect` that commits the latest composition
  snapshot when the input unmounts mid-composition (popover close,
  modal dismiss). Snapshots tracked via `lastCompositionValueRef`;
  callback captured via `onCommitRef` to survive empty-deps cleanup.

- Add `cancelComposition` for non-text-mode swaps. `CustomInputPopoverObject`
  invokes it via `useEffect` when `isSelectionMode` toggles true, so
  the readOnly-render path can't strand the composing flag and silently
  swallow later plain keystrokes.

- Snapshot `compositionStartValueRef` so flush skips phantom commits
  when an orphan dead-key blur leaves `element.value` unchanged.

- Stabilize `commitValue` in `useIMEInputForOnChange` via `onChangeRef`
  so `flushPendingComposition` and `cancelComposition` keep stable
  identities across parent rerenders, preventing downstream
  `useEffect([cancelComposition])` from re-firing on every render.

- Move explicit `onBlur` after `{...imeInputProps}` in 4 components so
  future hook additions can't silently override the flush handler via
  spread order.

Tests: 7 new cases covering blur-flush NFC, stuck-flag reset,
unmount-mid-composition commit, no-op when not composing, no-op when
composition made no progress, `cancelComposition` clearing the flag,
stable callback identity across rerenders, latest-onChange via ref.
193/193 pass in `parameterRenderComponent`.

* test(frontend): add IME input regression

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Viktor Avelino <64113566+viktoravelino@users.noreply.github.com>
Co-authored-by: Viktor Avelino <viktor.avelino@gmail.com>
2026-04-23 14:52:13 +00:00
2026-04-15 08:41:09 -07:00
2026-04-13 23:23:37 +00:00
2026-04-15 16:11:11 -04:00
2026-04-15 16:11:11 -04:00

Langflow logo

Release Notes PyPI - License PyPI - Downloads Twitter YouTube Channel Discord Server Ask DeepWiki

Langflow is a powerful platform for building and deploying AI-powered agents and workflows. It provides developers with both a visual authoring experience and built-in API and MCP servers that turn every workflow into a tool that can be integrated into applications built on any framework or stack. Langflow comes with batteries included and supports all major LLMs, vector databases and a growing library of AI tools.

Highlight features

  • Visual builder interface to quickly get started and iterate.
  • Source code access lets you customize any component using Python.
  • Interactive playground to immediately test and refine your flows with step-by-step control.
  • Multi-agent orchestration with conversation management and retrieval.
  • Deploy as an API or export as JSON for Python apps.
  • Deploy as an MCP server and turn your flows into tools for MCP clients.
  • Observability with LangSmith, LangFuse and other integrations.
  • Enterprise-ready security and scalability.

🖥️ Langflow Desktop

Langflow Desktop is the easiest way to get started with Langflow. All dependencies are included, so you don't need to manage Python environments or install packages manually. Available for Windows and macOS.

📥 Download Langflow Desktop

Quickstart

Requires Python 3.103.13 and uv (recommended package manager).

Install

From a fresh directory, run:

uv pip install langflow -U

The latest Langflow package is installed. For more information, see Install and run the Langflow OSS Python package.

Run

To start Langflow, run:

uv run langflow run

Langflow starts at http://127.0.0.1:7860.

That's it! You're ready to build with Langflow! 🎉

📦 Other install options

Run from source

If you've cloned this repository and want to contribute, run this command from the repository root:

make run_cli

For more information, see DEVELOPMENT.md.

Docker

Start a Langflow container with default settings:

docker run -p 7860:7860 langflowai/langflow:latest

Langflow is available at http://localhost:7860/. For configuration options, see the Docker deployment guide.

🛡️ Security

For security information, see our Security Policy.

🚀 Deployment

Langflow is completely open source and you can deploy it to all major deployment clouds. To learn how to deploy Langflow, see our Langflow deployment guides.

Stay up-to-date

Star Langflow on GitHub to be instantly notified of new releases.

Star Langflow

👋 Contribute

We welcome contributions from developers of all levels. If you'd like to contribute, please check our contributing guidelines and help make Langflow more accessible.


Star History Chart

❤️ Contributors

langflow contributors

Description
Langflow is a powerful tool for building and deploying AI-powered agents and workflows.
Readme MIT 2.3 GiB
Languages
Python 64.5%
TypeScript 23.4%
JavaScript 11.4%
CSS 0.3%
Makefile 0.2%
Other 0.1%