FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
118 stars 19 forks source link

Every update in datetime picker triggers Backend API call. #3104

Closed cristaloleg closed 2 months ago

cristaloleg commented 3 months ago

Can we access your project?

Current Behavior

I have a simple page related to user profile. When I'm opening a datetime picker (Cupertino style) and scrolling through days/months/years this scrolling triggers page rerender (which sounds reasonable). But this also triggers API call defined in Backend query tab for the page.

In other words every scroll in 1 useless API call which can easily DDOS server or exhaust user's rate limit.

Expected Behavior

Backend query happens once per page load or so.

Steps to Reproduce

  1. Create a page with Backend query with API call.
  2. Add a datetime picker
  3. Observe server logs with tons of requests on every update in datetime picker.

Reproducible from Blank

Bug Report Code (Required)

ITESlsn1z5BgrsgD15PcKMJQhQIgQ0QnU7gnlO1ucx4gfZDwB4kUdvfSYUNKT/WhSnNEOVCIjXIG7sLmufHpJscqOUyabpRG0JVATjqXZEaQaLKkCJeKR3wlAe9XGWa/4KWzvRImANVadCAj2DmbN63qNleeY8aSfxBlZ7vfcPo=

Visual documentation

Nothing to show

Environment

- FlutterFlow version: 4.1.54 (4.1.54)
- Platform: macOS
- Browser name and version: Chrome 125.0.6422.142
- Operating system and version affected: Sonoma 14.5

Additional Information

This completely blocks us from releasing application 'cause any user is able to generate legitimate HTTP request with 100x amplification.

Looks like this problem is deeper than just datetime picker rerender. Any visual change (rerender) triggers Backend query defined for the page.

msusviela commented 3 months ago

I was able to reproduce the issue, I will send it to the ENG team so they can work on this!

leighajarett commented 3 months ago

Have you tried using a backend call from an action instead? This way you can trigger when it would be called

cristaloleg commented 3 months ago

Theoretically this should work. AFAIR I had a problem with Action call on page load 'cause it happened after the render and page were missing the data.

I saw such behavior year ago or so, maybe it was a bug and now everything works fine. I will check this Mon-Tue, thanks for the answer.

leighajarett commented 3 months ago

Please give it a try and let me know how that goes! 🙂

cristaloleg commented 3 months ago

Bad news, it doesn't work. All the TextFields on the page are null, however JSON body from HTTP response have all fields. Looks like OnPageLoad happens after the page load (well, basically what it's name say) but to fill the text fields we need PrePageLoad method or so.

leighajarett commented 3 months ago

Hmm its hard for me to understand what you're saying - have you reached out to support by chance? They can take a closer look and help see if theres a better way to architect the database calls. Otherwise I can hop on a call Thursday morning EST if you're around (not sure if I will be able to solve it but at least I can better understand what you're mentioning)?

cristaloleg commented 3 months ago

I can contact support to provide more info. And if call will be required I can easily join it.

leighajarett commented 3 months ago

Sounds good!