-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Can we access your project?
- 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
Descrição do Bug
Ao tentar atribuir o Action Output
de uma Supabase Query Rows
(especificamente SupabaseEvents
da tabela events
), que o FlutterFlow descreve como Type: List < Row (events) >
ou Type: List < Json >
, a qualquer variável, App State, ou argumento de Custom Function/Action que espera o tipo List < Json >
, um erro return type mismatch
é exibido, impedindo a atribuição.
Comportamento Esperado
O Action Output
da Supabase Query Rows
, que é tipado como List < Json >
(ou List < Row (events) >
) na interface do FlutterFlow, deveria ser compatível e aceito por outras variáveis, App States ou argumentos de Custom Functions/Actions que também são configurados para esperar List < Json >
.
Comportamento Atual
O FlutterFlow exibe return type mismatch
e impede a atribuição em todos os cenários tentados, apesar de ambos os tipos (Action Output
da query e o destino) parecerem ser List < Json >
na interface.
Passos para Reproduzir
- Configuração da Query Supabase:
- Crie uma
Backend Query
do tipoQuery Rows
para uma tabela no Supabase (no meu caso, a tabelaevents
). - Defina o
Action Output Variable Name
comoSupabaseEvents
. - O tipo de retorno desta query é exibido como
Type: List < Row (events) >
.
- Crie uma
- Cenários Tentados (e com erro
return type mismatch
):- Atualizar App State diretamente:
- Crie um
App State
chamadoEvents
(ou similar) do tipoJSON
comIs List
marcado. - Tente atribuir o
Action Output
SupabaseEvents
diretamente a esteApp State
. Ocorrereturn type mismatch
.
- Crie um
- Passar para Custom Function (
formatEventsForCalendar
):- Crie uma Custom Function
formatEventsForCalendar
com um argumentosupabaseEvents
do tipoJSON
eIs List
marcado. - No
Custom Widget Properties
doEventCalendar
, tente passarSupabaseEvents
para o argumentosupabaseEvents
daformatEventsForCalendar
. Ocorrereturn type mismatch
.
- Crie uma Custom Function
- Passar para Custom Action (
updateEventsState
/manageSupabaseEvents
):- Crie uma Custom Action (ex:
updateEventsState
oumanageSupabaseEvents
) com um argumento (ex:eventsFromSupabase
oueventsData
) do tipoJSON
eIs List
marcado. - Tente passar o
Action Output
SupabaseEvents
para este argumento. Ocorrereturn type mismatch
.
- Crie uma Custom Action (ex:
- Tentativa de serialização/desserialização:
- Criei uma Custom Function
listToJsonString
(argumentojsonList
tipoJSON
,Is List
marcado; retornoString
). O objetivo era encodificarSupabaseEvents
paraString
. - Tentei passar
SupabaseEvents
para o argumentojsonList
dalistToJsonString
. Oreturn type mismatch
persiste neste ponto de atribuição inicial. (Não foi possível prosseguir com a desserialização).
- Criei uma Custom Function
- Atualizar App State diretamente:
Informações Adicionais / Contexto
- Fluxo de Trabalho Funcional: Tenho um fluxo de trabalho semelhante e funcional para a tabela
cpa_questoes
. Nele, umaBackend Call
(Query Rows
paracpa_questoes
,Action Output
allCpaQuestionsList
) é seguida por umLoop Action
. Dentro do loop, umaCustom Action
chamadamanageCpaResponse
é utilizada. - A
manageCpaResponse
recebe umApp State
(RespostasCPA
, tipoList <Json>
) como argumentocurrentResponses
(tambémList <Json>
na UI) e o seuAction Output
(updatedResponsesAfterSliderDefault
, tipoList <Json>
na UI) é atribuído com sucesso de volta aoApp State RespostasCPA
. - Isso sugere que o problema está especificamente na forma como o FlutterFlow encapsula e tipa o output direto de uma
Query Rows
do Supabase (SupabaseEvents
ouevents Rows
), tornando-o incompatível com o tipoList < Json >
em outros contextos de atribuição, mesmo que a UI indique compatibilidade. - O conteúdo do JSON retornado pela query é válido e esperado, como por exemplo:
{"idevents":"51c1eb78-0b79-4c32-9563-815bd7a980b6","iduser":574,"title":"Estudar",...}
.
Capturas de Tela / Vídeos
(Anexe todas as imagens relevantes aqui, copiando e colando-as. O GitHub geralmente permite arrastar e soltar ou fazer upload de arquivos. Lembre-se de referenciá-las no texto conforme fiz acima.)
image_ef5d75.png
: Detalhe do tipo de retorno da query Supabase.image_610d99.png
: Erro ao tentar atribuirSupabaseEvents
diretamente aoApp State
.image_61e735.png
,image_61e6dc.png
,image_6188a2.png
,image_61f943.png
: Erros ao tentar passarSupabaseEvents
para Custom FunctionformatEventsForCalendar
.image_445a7d.png
,image_fec9d8.png
: Erros ao tentar passarSupabaseEvents
para Custom Actions.image_61df57.png
: Exemplo do conteúdo doAction Output
da query.image_61fcc9.png
,image_618865.png
: Definições da Custom FunctionformatEventsForCalendar
.image_437d1d.png
: Definição de Custom ActionprocessRawSupabaseEvents
(tentativa anterior).image_fed9b5.png
: Definição da Custom ActionmanageCpaResponse
(exemplo funcional).image_43e9fd.png
,image_43e6bc.png
,image_fedcc0.png
,image_fedc9c.png
,image_fee07d.png
,image_43db78.png
,image_43ee5f.png
: Imagens do fluxo funcional commanageCpaResponse
para contexto.image_e560ed.png
: (Esta imagem é do formulário do GitHub, você pode remover ou usar como referência para preenchê-lo).
Código Relevante
(Cole os códigos Dart das suas Custom Functions e Actions aqui)
formatEventsForCalendar
(última versão com String como entrada):
import 'dart:convert';
import 'dart:math' as math;
import '/backend/supabase/supabase.dart'; // Mantenha se precisar
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
// ... outros imports
Map<String, List<String>> formatEventsForCalendar(String supabaseEvents) {
final Map<String, List<String>> eventsMap = {};
List<dynamic> parsedEvents;
try {
parsedEvents = jsonDecode(supabaseEvents);
} catch (e) {
print('Erro ao decodificar JSON na formatEventsForCalendar: $e');
return {};
}
for (var event in parsedEvents) {
if (event is Map<String, dynamic>) {
final DateTime? eventDate = (event['startdate'] is String)
? DateTime.tryParse(event['startdate'])
: (event['startdate'] is DateTime ? event['startdate'] : null);
final String? eventDescription = event['title'] as String?;
if (eventDate != null && eventDescription != null) {
final String formattedDate =
"${eventDate.year}-${eventDate.month.toString().padLeft(2, '0')}-${eventDate.day.toString().padLeft(2, '0')}";
if (!eventsMap.containsKey(formattedDate)) {
eventsMap[formattedDate] = [];
}
eventsMap[formattedDate]!.add(eventDescription);
}
}
}
return eventsMap;
}
<img width="968" height="724" alt="Image" src="https://github.com/user-attachments/assets/9f226041-a6f3-4e57-9a56-215f63c75362" />
### Expected Behavior
O `Action Output` da `Supabase Query Rows` (especificamente `SupabaseEvents` da tabela `events`), que o FlutterFlow descreve como `Type: List < Row (events) >` ou `Type: List < Json >`, deveria ser compatível e aceito por outras variáveis, App States ou argumentos de Custom Functions/Actions que também são configurados para esperar `List < Json >`.
### Steps to Reproduce
1. **Configure uma `Backend Query` do Supabase:**
* Adicione uma `Backend Query` na sua página, do tipo `Query Rows` para uma tabela do Supabase (no meu caso, a tabela `events`).
* Defina o `Action Output Variable Name` como `SupabaseEvents`. O tipo de retorno desta query é exibido como `Type: List < Row (events) >`.
2. **Tente atribuir o `Action Output` `SupabaseEvents` a um `App State`:**
* Crie uma variável de `App State` (ex: `Events`) do tipo `JSON` e com `Is List` marcado.
* Após a `Backend Query`, adicione uma `Update App State` action.
* Tente definir o valor de `Events` para o `Action Output` `SupabaseEvents`.
* **Resultado:** Um erro `return type mismatch` ocorre.
3. **Tente passar o `Action Output` `SupabaseEvents` para uma `Custom Function`:**
* Crie uma `Custom Function` (ex: `formatEventsForCalendar`) com um argumento (ex: `supabaseEvents`) configurado como `Type: JSON` e `Is List` marcado.
* No editor de propriedades de um widget (`EventCalendar` no meu caso), tente chamar a `Custom Function` `formatEventsForCalendar` e passar o `Action Output` `SupabaseEvents` para o argumento `supabaseEvents`.
* **Resultado:** Ocorre `return type mismatch`.
4. **Tente passar o `Action Output` `SupabaseEvents` para uma `Custom Action`:**
* Crie uma `Custom Action` (ex: `manageSupabaseEvents` ou `updateEventsState`) com um argumento (ex: `eventsData` ou `eventsFromSupabase`) configurado como `Type: JSON` e `Is List` marcado.
* Após a `Backend Query`, adicione esta `Custom Action`.
* Tente passar o `Action Output` `SupabaseEvents` para o argumento da `Custom Action`.
* **Resultado:** Ocorre `return type mismatch`.
5. **Contexto Adicional (Funcionalidade Semelhante que Funciona):**
* Observe que um fluxo de trabalho semelhante funciona perfeitamente ao lidar com dados de outra tabela Supabase (`cpa_questoes`).
* Uma `Backend Query` para `cpa_questoes` (`Action Output: allCpaQuestionsList`) é usada em um `Loop Action`.
* Dentro do loop, uma `Custom Action` chamada `manageCpaResponse` é executada. Esta `Custom Action` recebe um `App State` (`RespostasCPA`, do tipo `List < Json >`) como argumento `currentResponses`. O `Action Output` desta `manageCpaResponse` (`updatedResponsesAfterSliderDefault`, também `List <Json>`) é atribuído com sucesso de volta ao `App State RespostasCPA`.
* Este contraste sugere que o problema é específico de como o FlutterFlow tipa o `Action Output` direto da `Supabase Query Rows`.
6. **Conteúdo do JSON de Saída da Query:**
* O conteúdo do JSON retornado pela query é válido e segue o formato esperado (exemplo: `{"idevents":"51c1eb78-0b79-4c32-9563-815bd7a980b6", "iduser":574, "title":"Estudar", ...}`).
(Lembre-se de anexar todas as imagens referenciadas acima no relatório do GitHub. Você pode arrastar e soltar as imagens na caixa de descrição, e elas serão automaticamente carregadas e aparecerão como ``.)
### Reproducible from Blank
- [ ] The steps to reproduce above start from a blank project.
### Bug Report Code (Required)
IT4Cl8j6yItPssgB+KrucsdVgjgsQ0w5RY0/ju5ETQw0N5PND+x/esnRQFJuZ9OrdghYMVmZvHIe7tbXm9z1FcY6PUiZbKpywc9LEwHxTkauMMWgDJG0fnR+GshgBXaY04m32gkkPu9hSiAu7DqUIO6uaCjcJJzSDkQSQ/+bIt7XmAfuQ0SLb3kNh1JWeC/v
### Visual documentation
<img width="968" height="724" alt="Image" src="https://github.com/user-attachments/assets/84311118-5ddd-4051-9d0c-ca696d139b79" />
Por favor, veja as capturas de tela anexadas que demonstram o problema:
1. **Tipo de Retorno da Query Supabase:**
* `image_ef5d75.png`: Mostra que o `Action Output` da `Query Rows` (`SupabaseEvents`) é `Type: List < Row (events) >`.
2. **Erros de `return type mismatch` ao tentar atribuir `SupabaseEvents`:**
* `image_610d99.png`: Tentativa de atribuir `SupabaseEvents` (Action Output) a um `App State` do tipo `List < Json >` resulta em `return type mismatch`.
* `image_431027.png`: Outro exemplo de `return type mismatch` ao tentar atribuir `SupabaseEvents` a um `App State` (`Events` - `List < Json >`).
* `image_61e735.png`: Erro ao tentar passar `SupabaseEvents` para o argumento `supabaseEvents` (tipo `List < Json >`) de uma `Custom Function` (`formatEventsForCalendar`).
* `image_61e6dc.png`: Outro ângulo do erro acima.
* `image_6188a2.png`: Mais uma visualização do mesmo `return type mismatch` na `Custom Function`.
* `image_61f943.png`: Erro ao tentar usar `events Rows` (Action Output da Supabase Query) no argumento de uma `Custom Function`.
* `image_445a7d.png`: Erro ao tentar passar `SupabaseEvents` para o argumento `eventsFromSupabase` (tipo `List < Json >`) de uma `Custom Action` (`updateEventsState`).
* `image_fec9d8.png`: Erro similar ao tentar passar `SupabaseEvents` para o argumento `eventsData` (tipo `List < Json >`) de outra `Custom Action` (`manageSupabaseEvents`). Note que o FlutterFlow exibe `Type: List < Json >` para ambos os lados, mas ainda assim dá erro.
* `image_e56857.png`: Demonstração da falha na tentativa de serialização: `SupabaseEvents` (Type: `List < Json >`) não pode ser passado para `listToJsonString` (argumento `jsonList` Type: `List < Json >`).
3. **Configurações de Funções e Widgets:**
* `image_61fcc9.png`: Configuração da `Custom Function` `formatEventsForCalendar` (argumento `supabaseEvents` como `List < Json >`).
* `image_618865.png`: Outra visualização da `formatEventsForCalendar` antes da mudança para `String`.
* `image_e5733b.png`: Configuração da `Custom Function` `formatEventsForCalendar` (argumento `supabaseEvents` como `String`) e o erro interno quando o código estava desatualizado.
* `image_6be321.png`: Configuração do `Custom Widget` `EventCalendar`, mostrando o parâmetro `eventsJson` do tipo `JSON`.
* `image_6be2a8.png`: Detalhe da atribuição `events Rows` ao parâmetro `eventsJson` do `EventCalendar` (`Type: Json`).
* `image_437d1d.png`: Definição de uma `Custom Action` anterior (`processRawSupabaseEvents`) que tentava lidar com `rawSupabaseData` como `List < Json >`.
4. **Exemplo de Fluxo Funcional (para contraste):**
* `image_fee07d.png`: Visão geral do fluxo de ações para `cpa_questoes` que funciona.
* `image_43db78.png`: Detalhe do `Loop Action` chamando `manageCpaResponse`.
* `image_fedd7c.png`: Configuração da `Query Rows` para `cpa_questoes` (`Action Output` `allCpaQuestionsList`).
* `image_fedd59.png`: O `Loop Action` usando `allCpaQuestionsList`.
* `image_43ea98.png`: Exemplo de `Backend Call API` que precede a query.
* `image_fed9b5.png`: Código e argumentos da `Custom Action` `manageCpaResponse` (funcional). Note que o argumento `currentResponses` é `dynamic` no Dart mas `List < Json >` na UI.
* `image_43e9fd.png`: `manageCpaResponse` recebendo `RespostasCPA` (App State `List < Json >`).
* `image_fedcfd.png`: Outra visualização da `manageCpaResponse` recebendo `RespostasCPA`.
* `image_fedcc0.png`: `Action Output` `updatedResponsesAfterSliderDefault` da `manageCpaResponse`.
* `image_43e6dd.png`: Detalhe do `Action Output` da `manageCpaResponse`.
* `image_43e6bc.png`: `updatedResponsesAfterSliderDefault` sendo atribuído com sucesso ao `App State RespostasCPA` (`List < Json >`).
5. **Conteúdo do JSON:**
* `image_61df57.png`: Exemplo do conteúdo do `Action Output` `SupabaseEvents` da query.
(Se você tiver um código de relatório de bug gerado diretamente pelo FlutterFlow, cole-o na seção "Código de relatório de bug (obrigatório)".)
### Environment
```markdown
- FlutterFlow version: 6.0.50
- Platform: Web App, iOS, Android
- Browser name and version: Google Chrome Version 126.0.6478.127
- Operating system and version affected: Windows 11
Additional Information
No response