Skip to content

Unable to access Doc References from AppState variables #930

@SingleSourceStudios

Description

@SingleSourceStudios

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

The page called chat_main, has is a list view on the right, just below the Container with the text 'Chat with',
that list view, needs to have a Query Type 'Document from Reference', and reference the collection 'Users' with the AppState variable called, 'activeChat' (Created in AppStates)

In the Query 'Document from Reference' panel, the Collection 'Users' is selected, and upon choosing the variable 'activeChat' an additional panel is opened, displaying 'Document ID' in red and it cannot be selected.

AppState Variable Issue

Here is the link to the project:
https://app.flutterflow.io/project/test-ff-bug-u4swoz

Expected Behavior

In the Query 'Document from Reference' panel, the Collection 'Users' should selected with the variable 'activeChat' created in 'AppStates'

This should then show me the 'Document from Reference' query in the 'List View'

AppState Variable Result

Steps to Reproduce

Shortened Version

Pre-Requisites:
A. Create a Collection 'Users'
A1: Create 2 Users

B. Create A Collection 'Chats'
B1: Create a chat between the 2 users

C. Create a Sub-Collection within Chats called 'Messages'
C1: Create any amount of messages for both users (1 each is suffice)

Screenshot 2023-05-25 at 00 50 47 Screenshot 2023-05-25 at 00 51 12

D. Create an AppState 'activeChat' > Document Reference > 'Chats'

Screenshot 2023-05-25 at 00 50 14

Build

  1. Create a Page.
  2. Create a Column.
  3. Create a StackView in that Column
  4. Create a Row in that Column
  5. Create a ListView in that Row
    5.1. Set a Query Collection > Messages > Variable set to the AppState 'activeChat'
Screenshot 2023-05-25 at 00 35 56
  1. Create a StackView in that ListView from (5.)
  2. Create 2 Rows inside the StackView : Row A & Row B
    7.1. Row A: Set Main Axis Alignment Left
    7.1.1. Create a Container with a Column and 2 Text Fields inside the Column

7.2. Row B: Set Main Axis Alignment Right
7.2.1. Create a Container with a Column and 2 Text Fields inside the Column

8A. Row A: Set Conditional Visibility > Single Condition >
8A-1. First Value: uid (Messages) - Is not equal to > Second Value: User ID (Authenticated User)

Screenshot 2023-05-25 at 00 41 59

8B. Row B: Set Conditional Visibility > Single Condition >
8B-1. First Value: uid (Messages) - Is equal to > Second Value: User ID (Authenticated User)

Screenshot 2023-05-25 at 00 45 57

Reproducible from Blank

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

Bug Report Code (Required)

IT4sz/Hqx89goddd+KryKPl7/WE7OUR8a+YSscp8WQgafIjJP4kQPPWkNltWOObnYWNiPUSmmTkEpvzHiM71MfYoJSWBRrpPyKpuFjrveECVQZOBO5GKPXZ9EdNNBU+P0MKF3BZCXPtuL2A11E+QDOTJQnTYQZDxImdISq/LZO4=

Context

I have failed to demo my MVP on-time to a client (Bank) with a user base of 5 Million Users.
Among many other heart-aches, tears and frustration.

Still love FlutterFlow a lot (Great Platform)

Visual documentation

Screenshot 2023-05-25 at 00 55 18

Additional Info

I used this code as a Custom Function

`import 'dart:convert';
import 'dart:math' as math;

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
import 'package:timeago/timeago.dart' as timeago;
import '../../flutter_flow/lat_lng.dart';
import '../../flutter_flow/place.dart';
import '../../flutter_flow/custom_functions.dart';
import '/backend/backend.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import '/backend/schema/structs/index.dart';
import '/auth/firebase_auth/auth_util.dart';

String? getOtherUser(
List userList,
String authUser,
) {
/// MODIFY CODE ONLY BELOW THIS LINE

return userList.first == authUser ? userList.last : userList.first;

/// MODIFY CODE ONLY ABOVE THIS LINE
}
`

This is to make Row A. display as other user and Row B, as the Authenticated user.

Not replicated in the steps above.

What is replicated above, is suffice to see that :

The AppState Variable 'activeChat' which is a Document Reference to the 'Chats' Collection cannot be selected if the Query Collection on the 'ListView' widget is set to Document Reference > 'Chats"

Environment

- FlutterFlow version: v3.1
- Platform: Flutter 3.7.12
- Browser name and version: Google Chrome: Version 113.0.5672.126 (Official Build) (arm64)
- Operating system and version affected: macOS Ventura: Version 13.3.1 (a)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions