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.

Pass event object to getEdgeProps() ?

See original GitHub issue

I was thinking of a few scenarios where it would be helpful to pass the event object to getEdgeProps(). Primarily if you want to use event.waitUntil().

Alternatively we could have another method like edgeEffect() that would be an async function who’s return would be put into event.waitUtnil() for the user.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jplhomercommented, Nov 8, 2020

@davidbarratt I like this idea! Should be a simple PR if you’re interested 👍 Otherwise I can get to it sometime.

0reactions
subhendukunducommented, Feb 14, 2021

I have a use case where I need to redirect a user based on some data in KV. https://github.com/subhendukundu/cool-bio-worker/blob/main/src/pages/bio/index.js#L28

So can do something like this? If this is already possible please guide me the doc

export async function getEdgeProps({ params, event }) {
  const { bio } = params;
  const data = await BIOS.get(bio, "json");
  // redirect them if it has forwardLink link alreadry
  if (data.forwardLink) {
    return   Response.redirect(data.forwardLink)
  }
  return {
    props: {
      data,
    },
  };
}

If it was NextJS I could do something like

return {
      redirect: {
        permanent: false,
        destination: forwardLink.url,
      },
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pass the event object to a React event handler function?
In Option #1 you are actually passing the event, since you pass the function object, it's roughly the equivalent of
Read more >
Data Fetching - Flareact
You must return an object from getEdgeProps : It should contain a props property containing the props to be passed to your component;...
Read more >
(Oracle Graph Java API Reference Release 20.4 (F15858-05))
Base class for Property Graph (PG) graph configuration objects. AbstractPgGraphConfig() ... getEdgeProps() - Method in class oracle.pgx.config.GraphConfig.
Read more >
flareact - Bountysource
Effectively there is no way to do both getEdgeProps() for data fetching when the ... With every page load, I see the __FLAREACT_DATA...
Read more >
How to pass a parameter to an event handler or callback
Passing the event object of react as the second argument. If you want to pass a parameter to the click event handler you...
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