-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Describe the bug
I have an app with default.svelte layout and an alternative docs.svelte layout.
The docs layout can be applied by adding layout: 'docs' to a page. The docs layout component receives all frontmatter properties as component props, including layout. This is expected behavior but it triggers a warning in the console:
<Docs> was created with unknown prop `layout`.
Because my docs.svelte does not expect a prop layout.
To suppress the warning, I added the following ugly workaround to the <script> tag of the docs.svelte layout:
export let layout: string;
layout;To Reproduce
Create an alternative layout component without prop layout.
Expected behavior
Maybe do not pass on the layout prop?
Screenshots
n/a
Desktop (please complete the following information):
n/a
Smartphone (please complete the following information):
n/a
Additional context
The alternative layout of the demo, https://github.com/TorstenDittmann/svelte-markdoc-preprocess/blob/main/apps/demo/src/lib/layouts/Alternative.svelte, uses the layout prop to display the layout name. That's why it does not throw the warning in the console. Makes sense for this demo, but not something you would normally do with the layout prop.