GithubHelp home page GithubHelp logo

Comments (4)

LoTwT avatar LoTwT commented on June 10, 2024

Hi, there.

I'm trying to resolve a similar problem in vite-plugin-inspect first. I'm not sure if the solution is appropriate. If you are interested in this issue, please check vite-plugin-inspect #104. ๐Ÿ˜Š

from devtools-next.

LoTwT avatar LoTwT commented on June 10, 2024

description

After the vite-plugin-inspect #104 merged, I tried to resolve this issue. I made a demo to test if it can use the RPC function defined in the vite-plugin-inspect. The code is as follows

// client/src/pages/graph.vue
async function foo() {
  const hot = await getViteHotContext()
  if (hot) {
    createRPCClient('vite-plugin-inspect', hot, {
      async moduleUpdated() {
        console.log('module-update')

        try {
          const root = await bridgeRpc.root()
          bridgeRpc.getGraph().then((res) => {
            parseGraphRawData(res, root)
          }).catch(e => console.log('getGraph-error', e))
        }
        catch (error) {
          console.log('update-error', error)
        }
      },
    })
  }
}

onMounted(() => {
  foo()
})

The console.log('module-update') was triggered successfully. However, when calling the APIs of bridgeRpc, it will result in a timeout error and the errors are as follows:

image

questions

  • The limit of using bridgeRpc, if there are some attentions that should be particularly paid to?
  • The moduleUpdated RPC function is defined in the vite-plugin-inspect, but the RPC client available is registered with the name vite-plugin-vue-devtools in this repo. I'm not sure using createRPCClient directly in the client is a more appropriate way. ๐Ÿ˜ข

from devtools-next.

webfansplz avatar webfansplz commented on June 10, 2024

description

After the vite-plugin-inspect #104 merged, I tried to resolve this issue. I made a demo to test if it can use the RPC function defined in the vite-plugin-inspect. The code is as follows

// client/src/pages/graph.vue
async function foo() {
  const hot = await getViteHotContext()
  if (hot) {
    createRPCClient('vite-plugin-inspect', hot, {
      async moduleUpdated() {
        console.log('module-update')

        try {
          const root = await bridgeRpc.root()
          bridgeRpc.getGraph().then((res) => {
            parseGraphRawData(res, root)
          }).catch(e => console.log('getGraph-error', e))
        }
        catch (error) {
          console.log('update-error', error)
        }
      },
    })
  }
}

onMounted(() => {
  foo()
})

The console.log('module-update') was triggered successfully. However, when calling the APIs of bridgeRpc, it will result in a timeout error and the errors are as follows:

image ## questions * The limit of using `bridgeRpc`, if there are some attentions that should be particularly paid to? * The `moduleUpdated` RPC function is defined in the `vite-plugin-inspect`, but the RPC client available is registered with the name `vite-plugin-vue-devtools` in this repo. I'm not sure using `createRPCClient` directly in the `client` is a more appropriate way. ๐Ÿ˜ข

Try to add timeout: -1 to the vite-dev-rpc option. See context:

https://github1s.com/webfansplz/vite-plugin-vue-devtools/blob/HEAD/packages/core/src/vite-dev-rpc.ts#L60

antfu/vite-dev-rpc#1

from devtools-next.

LoTwT avatar LoTwT commented on June 10, 2024

@webfansplz timeout:-1 doesn't work. Before, I tried the original communication way of vite using server.ws.send and import.meta.hot.on, but the bridgeRpc still doesn't work yet. ๐Ÿ˜ข

from devtools-next.

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.