Skip to content

Commit

Permalink
Issue #25: Move to mount() instead of new to instantiate components.
Browse files Browse the repository at this point in the history
  • Loading branch information
patricknelson committed Nov 28, 2023
1 parent f3e884b commit 1812b99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions demo/vercel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"preview": "vite preview"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^2.4.6",
"svelte": "^4.0.5",
"vite": "^4.3.0"
"@sveltejs/vite-plugin-svelte": "^3.0.0-next.3",
"svelte": "^5.0.0-next.14"
}
}
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSvelteSlots, findSlotParent, unwrap } from './utils.js';

import { mount } from 'svelte';

// Tracks the mapping of case-insensitive attributes to case-sensitive component props on a per-tag basis. Setup as a
// global cache so we can avoid setting up a Proxy on every single component render but also to assist in mapping during
Expand Down Expand Up @@ -471,7 +471,7 @@ export default function(opts) {

// Instantiate component into our root now, which is either the "light DOM" (i.e. directly under this element) or
// in the shadow DOM.
this.componentInstance = new opts.component({ target: this._root, props: props, context });
this.componentInstance = mount(opts.component, { target: this._root, props: props, context });

this._debug('renderSvelteComponent(): completed');
}
Expand Down

0 comments on commit 1812b99

Please sign in to comment.