Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeart committed Jul 9, 2024
1 parent 06c193c commit a53622a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ export function signal<Value = any>(
) {
if (args[1].kind === "accessor") {
return stateDecorator(
...(args as Parameters<typeof stateDecorator<Value>>)
...(args as Parameters<typeof stateDecorator<Value>>),
);
}

if (args[1].kind === "getter") {
return computedDecorator(
...(args as Parameters<typeof computedDecorator<Value>>)
...(args as Parameters<typeof computedDecorator<Value>>),
);
}

Expand All @@ -76,7 +76,7 @@ export function signal<Value = any>(

function stateDecorator<Value = any>(
target: ClassAccessorDecoratorTarget<unknown, Value>,
context: ClassAccessorDecoratorContext
context: ClassAccessorDecoratorContext,
): ClassAccessorDecoratorResult<unknown, Value> {
const { get } = target;

Expand Down Expand Up @@ -109,7 +109,7 @@ function stateDecorator<Value = any>(

function computedDecorator<Value = any>(
target: () => Value,
context: ClassGetterDecoratorContext
context: ClassGetterDecoratorContext,
): () => Value {
const kind = context.kind;

Expand Down
5 changes: 3 additions & 2 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function pushActiveTransaction(transaction: Transaction): void {

export function signalTransactionSetter(
signal: Signal.State<any>,
value: any
value: any,
): void {
if (activeTransaction) {
const { cellState, usedCells, seenCells } = activeTransaction;
Expand Down Expand Up @@ -72,7 +72,8 @@ export class Transaction {
this.execute(fn);
}
this.ensureSafeToCommit();
const parentTransaction = activeTransactions[activeTransactions.length - 1] || null;
const parentTransaction =
activeTransactions[activeTransactions.length - 1] || null;
if (parentTransaction) {
const { usedCells, cellState } = parentTransaction;
this.usedCells.forEach((signal) => {
Expand Down

0 comments on commit a53622a

Please sign in to comment.