Skip to content

Input type=file dialogue triggers windows focus refetch #2960

@Dynalon

Description

@Dynalon

Describe the bug
Using an <input type="file" onChange={onChangeHandler} /> component will bring up a file chooser to chose your files (i.e. for uploads). The problem is, that at least on macOS/Chrome, once the dialog box disappears after you chose the file, this triggers the refetchOnFocus event (if enabled). This bug cost me hours to debug, as the onChangeHandler was never called - the refetch triggered a re-render and thus the component was unmounted (and remounted) before the onChangeHandler actually could fire.

To Reproduce
Steps to reproduce the behavior:

  1. Use any <input type="file" onChange={onChange} />
  2. Click on "Choose file" and select a file
  3. Observe the refetchOnFocus (possibly triggering a re-render)
  4. onChange handler is not fired

Expected behavior
The <input type="file" /> dialog should be exempted from the refetchOnFocus event

Desktop (please complete the following information):

  • OS: macOS
  • Browser: latest Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions