Git Product home page Git Product logo

Comments (4)

kayhadrin avatar kayhadrin commented on June 14, 2024

from fbt.

cpojer avatar cpojer commented on June 14, 2024

Admittedly, I have a funky use-case here:

  • I have user-generated input that is extracted from the db and translated.
  • Users may change the initial text which may or may not provide the same params as before.
  • I have custom params that end up using the same token delimiters ({ and }) because otherwise it doesn't work well with my translation provider (crowdin). Those params are substituted from the translated string with user-generated data separately from fbt.

With all of these constraints combined, I had a try-catch around my fbt calls for user-generated text, since the invariant would crash the game rather than falling back to the non-translated input. I then realized that the invariant was skipped and undefined was inserted. I worked around by patching fbt, which works great for me.

Here is a real scenario I can imagine happening many times at Facebook:

  • Dev amends code before landing without trying it. Reviewer approves without trying it.
  • Code is actually wrong, but doesn't throw in prod because the invariant is dev only.
  • Code now renders "undefined" in place of the param in a user-facing string in prod.

from fbt.

cpojer avatar cpojer commented on June 14, 2024

Fixed by @voideanvalue in bd91582 and f409115.

from fbt.

kayhadrin avatar kayhadrin commented on June 14, 2024

from fbt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.