Open staplKody opened 2 weeks ago
more context:
I've narrowed it down to how the JSON is being parsed by the code. This particular action is where it is hanging up. and here is the generated code
I have a custom code solution that works as you would expect the generated code to behave. Feel free to use this to improve the generated code.
List
//this function replaces the built in FF logic since it fails to return when jsonData.length <= 1
if (jsonData is List) {
// Map the List
/// MODIFY CODE ONLY ABOVE THIS LINE }
Replacing the built in actions with this custom function to set my "contracts" component state solved the issue. I am not entirely sure where the generated code is failing, and I am sure there may be some oversight in my function that needs to be considered for the generated function.
Hi @staplKody!
I believe the issue you're experiencing might be related to the custom code in your actions (see attachment). Could you review that code and see if it might be causing the problem?
That section of code is working as expected. The hangup only occured once the app attempted to parse the ARRAY property of my API response which occurs after that code expression is evaluated.
This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.
The issue is not resolved. There is a bug in the generated code shown above. I attached my solution that I implemented to resolve it for me, however I wouldn't consider this resolved unless FF has had an update modifying the generated code from the above action.
Hi @staplKody,
Based on your code, it looks like nothing will happen if the response contains fewer than 3 elements. You might want to adjust for that condition.
The code you are referencing is on the input side. I won't run my queries until there are at least three characters inputted. What I am saying is the OUTPUT being 1 or 0 elements causes the issue.
Can we access your project?
Current Behavior
I have an API call that returns a JSON response with an array inside. When tested in my API setup, the response returns 200 and the expected array. In my component that is using this API, when an input is provided, an array is correctly acquired from the API's JSON path "ARRAY" and elements are produced in my listview. However, if my array is only one element or zero elements, the logic following the API call in my component is never reached. It appears that the API call function is never returning, and so the application is perpetually awaiting the call.
Expected Behavior
I would expect the API function to return even if one element or zero elements are present in the array, and the component "contracts" that is being populated to match the returned array's size and elements.
Steps to Reproduce
create a component with a text box, an icon to illustrate "loading", and a list widget.
Make an API call that returns a JSON response with an array inside.
On change of the textbox, set the component state "isLoading" to true which the icon has conditional visibility set to. Then make the API call, then set the API call's response.ARRAY (or whatever it is named in your API call's response definition) to a component called "contracts" as a defined data type. Last, set the "isLoading" state to false to make the icon hide again and indicate the process is finished.
Pass a value in the textbox that will return one or less items. (in my case passing in an exact contract number like 42133 results in one exact value, and anything longer than 5 characters will result in no items). Observe that the "isLoading" state never gets set to false and the "contracts" component state never gets set from this search (it retains its previous state before any text was changed in the textbox).
Reproducible from Blank
Bug Report Code (Required)
IT4kkcjfsMx2rsdY17X5be5Fv2UUQlAgTLIFse0aRR4jJYDyP5YAYM7SV0NKTfXnen9MM1agnj0G+vTNvt/1VO0pPT6aQNV70JVAZhfxZFO5VZfXCYewen8lTN1XI0iP37SRsBNCWLdtWF4c6k+pNa3qNleeY8aSfxBlZ7vfcPo=
Visual documentation
Environment
Additional Information
No response