question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Thoughts on extending the API

See original GitHub issue

Hi again!

Consider a scenario where inside of getComponent, we’d like to return a React component rendered with either with renderReact or renderReactStatic, depending on the context (eg legacy reasons).

My initial thought is that we could do something funky like define NameOfComponent and NameOfComponentStatic and pass such args though the component name.

What would be even better though is to be able to define custom args; something like

{
  "NameOfComponent": {
    "name": "NameOfComponent",
    "args": {
       "renderType": "static",
    },
    "data": {
      "theseAreProps": true,
      "someOtherProps": ["one", "two", "three"]
    },
  }
}

and args gets passed alongside name to getComponent.

Does this seem reasonable? Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
goatslackercommented, Apr 7, 2017

Yes this sort of logic is best served by a hypernova-client like hypernova-react.

A hypernova client is just a function so you can do and return whatever you’d like.

0reactions
goatslackercommented, May 13, 2017

I still need a way to pass the ‘isStatic’ flag (amongst other server only args) through to Hypernova from the clientlib 😃

I see, so your other server is the one that holds the knowledge on whether you want to render something static or non-static. If thats’ the case you can pass that sort of information down with the initial payload:

{
  renderStyle: 'static',
  componentProps: serializableProps,
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Extending the Kubernetes API: What the Docs Don't Tell You [I]
Extending the Kubernetes API : What the Docs Don't Tell You [I] - James Munnelly, JetstackAt the heart of Kubernetes ... 5K views...
Read more >
Web API Thoughts 3 of 3 - Extending Web API Documentation
One possible solution is to extend the API documentation provider so that Web API methods will be attributed with actual request/response ...
Read more >
Extension API - Visual Studio Code
This documentation describes: How to build, run, debug, test, and publish an extension.
Read more >
Extending the REST API (REST Application Developer's Guide)
You can extend the REST Client API in a variety of ways, including resource service extensions and evaluation of ad-hoc queries and server-side...
Read more >
What is an API? - Red Hat
Innovating with APIs · Create new revenue channels or extend existing ones. · Expand the reach of your brand. · Facilitate open innovation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found