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

[feat] Error handling API as discussed in #1096 #6585

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed issue caused by if statements
Changed how component is accessed when attaching error handler to a listener
  • Loading branch information
rster2002 committed Jul 29, 2021
commit 068405191eeaf95cf5587a9dbcc19bb9abf664dc
2 changes: 1 addition & 1 deletion src/compiler/compile/render_dom/Block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ export default class Block {
this.add_variable(dispose);

this.event_listeners.forEach((event_listener: any) => {
event_listener.arguments[2] = x`@attach_error_handler(${event_listener.arguments[0]}, #component, ${event_listener.arguments[2]})`;
event_listener.arguments[2] = x`@attach_error_handler(${event_listener.arguments[0]}, @get_current_component(), ${event_listener.arguments[2]})`;
});

if (this.event_listeners.length === 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/compile/render_dom/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export default function dom(
const has_create_fragment = component.compile_options.dev || block.has_content();
if (has_create_fragment) {
body.push(b`
function create_fragment(#ctx, #component) {
function create_fragment(#ctx) {
${block.get_contents()}
}
`);
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/internal/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export function init(component, options, instance, create_fragment, not_equal, p
run_all($$.before_update);

// `false` as a special case of no DOM component
$$.fragment = create_fragment ? create_fragment($$.ctx, component) : false;
$$.fragment = create_fragment ? create_fragment($$.ctx) : false;

if (options.target) {
if (options.hydrate) {
Expand Down