Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[breaking] add embedded option, turned off by default #7969

Merged
merged 6 commits into from
Dec 9, 2022

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Dec 6, 2022

Migration

If you relied on the new behavior introduced in #7766, you can get that back by adding embedded: true to your svelte.config.js:

export default {
  kit: {
+    embedded: true
  }
}

PR description

Closes #7940
Closes #4935
Adds a new option which defaults to false. If true, events related to navigation etc are listened to on the target element rather the html root

Open questions solved:

  • approach sensible? I figured using the define feature for this is the most straightforward and treeshakes nicely it is
  • using data-sveltekit-root instead (as discussed in the issue)? Advantage: no config option, more control ("I use popper.js with embedded Kit, and it adds itself to some tag higher than the target). Disadvantage: feels clunky, a little more startup code that might not be as reliable. option is the way to go

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

Closes #7940
Adds a new option which defaults to false. If true, events related to navigation etc are listened to on the target element rather the html root
@changeset-bot
Copy link

changeset-bot bot commented Dec 6, 2022

🦋 Changeset detected

Latest commit: 9e7c889

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Dec 6, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
kit ✅ Ready (Inspect) Visit Preview Dec 7, 2022 at 10:52AM (UTC)
kit-svelte-dev ✅ Ready (Inspect) Visit Preview Dec 7, 2022 at 10:52AM (UTC)

@arackaf
Copy link

arackaf commented Dec 6, 2022

🎉🥳🎊🍾

Copy link
Member

@benmccann benmccann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a docs change still for this one

@Rich-Harris
Copy link
Member

I'm not sure how best to add docs for this beyond https://kit-svelte-e9gz8bfaa-svelte.vercel.app/docs/configuration#embedded? (Though I guess it should probably mention the params stuff. Oh, and we can skip sending params from the server unless embedded: true. Will update in a sec)

image

This is a niche enough thing that it probably doesn't warrant a new section of the docs — I think it's probably enough that people can find it via the config docs, and we can point people to it as and when needs arise.

@Conduitry
Copy link
Member

I'm in favor of not documenting this further than this note in the configuration docs, especially since the old default behavior was (it would seem) solely for the benefit of the NY Times and I'm sure they have other out-of-band ways of complaining to you.

@arackaf
Copy link

arackaf commented Dec 8, 2022

Should we investigate which irresponsible individual at the NYT was shipping things to production using a pre-beta application framework?

@johnnysprinkles
Copy link
Contributor

Awesome, I just got SvelteKit 1.0.0-next.584 and can confirm #4935 is resolved. By the way, this is for a SvelteKit app related to the recently announced Apple Music Sing feature.

@patriciatiffany
Copy link

patriciatiffany commented Dec 12, 2023

I came here from the docs, trying to figure out what embedded: true does, exactly. I have an inkling it will be useful for my use cases (I use exclusively adapter-static), but that short phrase in the docs isn't quite enough for me to understand. Could I get some context?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GET form triggers an entire page reload if rendered outside of SvelteKit's root
7 participants