-
Notifications
You must be signed in to change notification settings - Fork 122
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
revamp(repl): Isolate each REPL instance #483
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -84,6 +84,8 @@ | |||
ast = compiled.ast; | |||
} | |||
|
|||
const { module_editor } = /** @type {import('../types').ReplContext}*/ (getContext('REPL')); |
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.
To avoid type casts, repetition of a string etc I suggest to move the set/getContext into a separate file like
// repl-context.js
const key = {}
/** @returns {..} */
export function getREPLContext() {
return getContext(key);
}
/** @param {..} */
export function setREPLContext(value) {
setContext(key, value);
}
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.
If it's in its own file, I'm scared if it will undo the isolation. As in, if I have multiple <Repl>
, won't they all have access to this same getContext in this case?
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.
Bumping this
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.
Ok this works. I still don't understand how, but it works 😅
No description provided.