Coder Social home page Coder Social logo

Comments (6)

garbles avatar garbles commented on July 18, 2024 1

Hey sorry! I somehow missed the email when this issue was opened so thanks for the bump. I'm on break now, so I'll take a look in the next few days.

from react-facade.

SrBrahma avatar SrBrahma commented on July 18, 2024

Up! @garbles would that be a possibility?

from react-facade.

SrBrahma avatar SrBrahma commented on July 18, 2024

Great! Many thanks! 😄

from react-facade.

garbles avatar garbles commented on July 18, 2024

Alright I just published v0.4.0 which should resolve this. LMK!

from react-facade.

SrBrahma avatar SrBrahma commented on July 18, 2024

Hi @garbles! Merry Christmas and many thanks!

I have a specific use case where it doesn't work and I understand if it isn't feasible as it's problematic. I use trpc, which usage I want is like the following: hooks.trpc.a.b.c.myEndpoint.useQuery(). The apparent issue is that trpc is already a proxy, so there is some kind of conflict with your implementation, which also uses a proxy. With the 0.4.0 change, the trpc type now shows to be used as there are some functions/hooks on its root.

With hooks.trpc()... I works since before but I don't like having to call it every time. As a possible solution, maybe we could have in this lib a function X (no idea how it could be called) that would just create a dummy class that you could check every root prop for instanceof, and if it's the case, it would use the given implementation without having to call it. The implementation could be something like { trpc: X(trpc) }, X being just something like

class classX {
  constructor(x) {
    return X
  }
};
const X = (x) => new classX(x)

I am not really sure how your implementation works as I haven't taken a long time to analyze it, but maybe it could just use normal objects instead of proxies to access the root props. With the Provider, we would just define the root object where the props are. hooks could be the result of react-hooks-global-state, and the provider argument would set the global state with the initial value of the provider property.

from react-facade.

garbles avatar garbles commented on July 18, 2024

@SrBrahma I'm happy to look into this, though I don't quite understand the problem. It would be super helpful if you made a demo repo (or a PR with a failing test).

from react-facade.

Related Issues (5)

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.