-
Notifications
You must be signed in to change notification settings - Fork 241
chore: cleanup code #189
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
chore: cleanup code #189
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
/** @type {'idle' | 'renaming'} */ | ||
let state = 'idle'; | ||
let editing_state = 'idle'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we just make this a boolean?
if (state.status === 'set' || state.status === 'switch') { | ||
loading = true; | ||
|
||
try { | ||
clearTimeout(timeout); | ||
await reset_adapter(state.stubs); | ||
|
||
if (state.status === 'switch') { | ||
set_iframe_src(adapter.base + path); | ||
} | ||
|
||
initial = false; | ||
} catch (e) { | ||
error = /** @type {Error} */ (e); | ||
console.error(e); | ||
} | ||
|
||
loading = false; | ||
} else if (state.status === 'update' && state.last_updated) { | ||
const reload = await adapter.update([state.last_updated]); | ||
if (reload) { | ||
schedule_iframe_reload(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this stuff feels racy — i feel like this logic belongs elsewhere, though i don't have a great design to offer right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The race conditions should be handled internally in adapter.js
, though I now realize I'm not making use of the "cancelled"
outcome here
closes #139
Output.svelte
adapter.js
state.js
with proper functions instead of writing to different writables all other the place