Giter Club home page Giter Club logo

Comments (7)

thejettdurham avatar thejettdurham commented on July 1, 2024 1

Oh I see...I didn't read your use-cases clearly enough 😅 Yeah, so your signature looks right then 3 possible options.

I have a PR open for my use case right now, I'll see later on today if it can be adapted to the more general case as well.

from talkback.

ijpiantanida avatar ijpiantanida commented on July 1, 2024 1

@thejettdurham @tartale I took some time to reply because I wasn't sure how to approach this problem.
I ended implementing the different modes but through the record option instead of introducing a new one.
You can read more here.
Feedback welcome 😃

@tartale for your pass-through case, you'd have to set record: RecordMode.DISABLED and fallbackMode: FallbackMode.PROXY.

I just released v1.10.0 which includes this feature.
Thanks for using talkback and for the useful idea.

from talkback.

tartale avatar tartale commented on July 1, 2024

I have a need for this feature as well, albeit with a caveat - for each request, I'd like to be able to provide a function that can examine the request, and decide to either:

  • cache the request (i.e. record a tape, and use it later)
  • not cache the request (i.e. record a tape, and don't use it later)
  • pass-through the request (don't record a tape at all)

My use case is similar; talkback is sitting transparently between components and recording activity, but I'm using this for test isolation. In other words, some requests should go through to the component under test, and the others should be cached, or simply recorded.

What do you think?

from talkback.

thejettdurham avatar thejettdurham commented on July 1, 2024

Personally, I like the idea! So instead of having an option like cache: boolean, it would be shouldCache: Request => boolean, right? Would the predicate need anything else passed to it?

from talkback.

tartale avatar tartale commented on July 1, 2024

I was thinking it would be something like cacheMode: Request => enum, where enum is something like 'cache' || 'no-cache' || 'pass-through', since there's potentially three distinct behaviors?

from talkback.

thejettdurham avatar thejettdurham commented on July 1, 2024

Okay, sorry for the delay, but I got my PR updated to take a cacheMode option that provides the desired behavior. Now we play the waiting game, it seems 😄

from talkback.

tartale avatar tartale commented on July 1, 2024

@ijpiantanida cool, thanks! I updated, will try this out

from talkback.

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.