Addon behavior...

Options

Hey, I have some addons that return arrays of objects... I'm looking for a way to prevent these addons from returning [null] instead of [] aka [0] when no data is found...

Reason i'm asking is because (thanks to Eli and Jared) we found out that an array with "null" inside, breaks/prevents the XanoSDK in Bubble from understanding what's the data.

Thanks!

Answers

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    Hey @Future - can you provide some more details on how your addon/query is all setup?

  • aemondis
    aemondis Member
    edited August 2023
    Options

    Hey @Michael Udinski, sorry for dredging up this one - but figured I'd continue it since it wasn't answered, and I am experiencing the identical issue. More context is in the thread in the bubble forum below:

    In essence, if you have an addon retrieving data within an array (in one example, configured to return a single value - refer below screenshot), and the addon returns no value - the array returned in the API is an empty array "[]". This is fine, and I would expect this behaviour in a proper standardised world.

    Since there is no role assigned in my case, Xano returns "[]" instead - and bubble fails to parse it, as it doesn't seem to handle empty arrays, or arrays with "[0: 0]" even, as I have discovered. The Xano connector is not entirely at fault here, from how I understand it at least, since it is leveraging bubble functions to hydrate objects into bubble types. There are possibly other means that could be used, but I'm not really a JS guy so can't comment here.

    From a Xano perspective - the only option I can see is having an easy way for an addon to return a value NOT as part of an object if it's just a single unnamed value (e.g. instead of returning [{"name":"consumer"}], simply return ["consumer"]). I suppose an eval could be used too, but not sure of the performance implications of eval & join vs. an addon or if it would even help address this behaviour. Thoughts?

    I however am all too aware that this is, ultimately, a problem for bubble to address - and history seems to suggest they won't any time soon, if at all. There's a reason I'm trying to move away from that platform as soon as possible… and it's limitations like this.

  • Marc Girard
    Options

    Hi @Future and @aemondis ,

    I have submitted a feature request if you want to upvote it.

    https://xano.nolt.io/359