Skip to content

Commit

Permalink
Fix behaviour of failing molecules
Browse files Browse the repository at this point in the history
  • Loading branch information
loganvolkers committed May 27, 2024
1 parent 0f23296 commit de70dfd
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions src/vanilla/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,29 +647,31 @@ function runMolecule(
useImpl.push(use);
let running = true;
trackingScopeGetter(InternalOnlyGlobalScope);
const value = m[GetterSymbol](trackingGetter, trackingScopeGetter);
running = false;
onMountImpl.pop();
useImpl.pop();

return {
deps: {
molecules: dependentMolecules,
allScopes,
defaultScopes,
mountedCallbacks,
/**
* Returns a copy
*
* Reverses the order so that the deepest dependencies are at the top
* of the list. This will be important for ensuring ordering for how
* mounts are called with transient dependencies.
*
*/
buddies: buddies.slice().reverse(),
},
value,
};
try {
const value = m[GetterSymbol](trackingGetter, trackingScopeGetter);
return {
deps: {
molecules: dependentMolecules,
allScopes,
defaultScopes,
mountedCallbacks,
/**
* Returns a copy
*
* Reverses the order so that the deepest dependencies are at the top
* of the list. This will be important for ensuring ordering for how
* mounts are called with transient dependencies.
*
*/
buddies: buddies.slice().reverse(),
},
value,
};
} finally {
running = false;
onMountImpl.pop();
useImpl.pop();
}
}

type CreationProps = {
Expand Down

0 comments on commit de70dfd

Please sign in to comment.