Skip to content

On Data Change generates invalid code when using single document query and attempting to access the field of that query document #1329

@isegal

Description

@isegal

Has your issue been reported?

  • I have searched the existing issues and confirm it has not been reported.
  • I give permission for members of the FlutterFlow team to access and test my project for the sole purpose of investigating this issue.

Current Behavior

Invalid code is generated:

	"Undefined name 'myComponentRecord'.
Try correcting the name to one that is defined, or defining the name.

Expected Behavior

It should be possible to access fields in the handler of On Data Changed

Steps to Reproduce

  1. Create a container component
  2. Add a firestore query to container, of type: Query Collection, Single Document query. Add any filter.
  3. Add a form field inside the container
  4. Add an On Data Change action to the same component. Set the form field to a field of the query document from Radio button initial value is blank #2.

Reproducible from Blank

  • The steps to reproduce above start from a blank project.

Bug Report Code (Required)

IT40hcnfz5Fgod9c1rrUK/lahmU5JlN9RI0Nke57aCsofePrOpkAf8/7UFtUOd+/SlVXfU6JjngX/MmKkdr1O8cEHymYfJQ/z8xcVA7hTXOnRZeYEq63b3wnO8pYJkzD5rSw3CNQXdtscmAmw2eMHvCsaBHZGYT3OUQWROaoXdeK2SrDX1iXc2URm05KZDPz

Context

Form fields only support "initial" value. It is impossible to update form fields as a result of "On Data Changed", even though FlutterFlow allows it, the code generated is invalid because the definition of the single document is place in an incorrect relative location, causing an undefined variable error.

Visual documentation

image image image

Additional Info

No response

Environment

- FlutterFlow version: v1.1.97
- Platform: iOS
- Browser name and version: Native FF
- Operating system and version affected: all

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions