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.

"Stuff" not present with Shadow Endpoints

See original GitHub issue

Describe the problem

With the recent advent of shadow endpoints https://github.com/sveltejs/kit/issues/3532, it is now possible to move all database requests or other external loading to the .ts or .js file.

However:

  • Shadow endpoints do not have an output of stuff like load functions.
  • Therefore, a load function is still required when wanting to pass stuff to __layout.svelte files.
  • While this doesn’t seem like a big deal, it is. When every page needs to pass stuff as an output - for example, for <meta> tags - then the entire point of shadow endpoints is defeated.

Describe the proposed solution

A possible solution could be to add an export of stuff to endpoint files. The complexity of this is unknown.

Alternatives considered

Require the user to provide a redundant load function on every page. However, this is suboptimal.

Importance

Would make my life a lot easier!

Additional Information

*crickets chirp*

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
babichjacobcommented, Feb 11, 2022

When every page needs to pass stuff as an output - for example, for <meta> tags - then the entire point of shadow endpoints is defeated.

Are you sure it’s that extreme?

The original issue for shadow endpoints includes an example of writing a load function easier than before when you can’t get away with not having a load function:

We could get the best of both worlds by feeding the props from the shadow endpoint into load …

For this situation, it’d be like:

<script context="module">
  /** @type {import('@sveltejs/kit').Load */
  export async function load({ props }) {
    return {
      props,
      stuff: { ... }, 
    }
  }
</script>

It is still the case, though, that you can’t send something from stuff to a shadow endpoint, but that isn’t what this issue explains.

1reaction
rmunncommented, Feb 22, 2022

Yes, I missed that you specified output in your description. So the only technical challenge would be merging any stuff from layouts (client-side) with stuff passed from shadow endpoints to the client. Which should be pretty straightforward.

I’ll update my comment to mention that it was a misunderstanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shadow Endpoints In Svelte Kit - Weekly Svelte - YouTube
Our first course drop coming March 3rd https://www.youtube.com/watch?v=LATf_lVYoMQ https://github.com/sveltejs/kit/issues/3532 Sign up for ...
Read more >
Device Shadow error messages - AWS IoT Core
The Device Shadow service publishes a message on the error topic (over MQTT) when an attempt to change the state document fails. This...
Read more >
Full Stack SvelteKit For Beginners - Joy of Code
SvelteKit is an opinionated full stack framework that ties the frontend and backend together delivering the best developer and user experience.
Read more >
box-shadow - CSS: Cascading Style Sheets - MDN Web Docs
The box-shadow CSS property adds shadow effects around an element's ... and that ranges from the full shadow color at the radius endpoint...
Read more >
Combining a shadow endpoints in Sveltekit with a form - Reddit
The get part works to serve the props data, but the form is not handled properly by the endpoint. Instead the page is...
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