Skip to content

Commit

Permalink
refactor(transaction): remove snapshot dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcourtice committed Jun 26, 2022
1 parent 055e164 commit d715465
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
3 changes: 0 additions & 3 deletions extensions/transaction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
"build": "yarn run --top-level tsup",
"prepublishOnly": "yarn build"
},
"dependencies": {
"@harlem/extension-snapshot": "^2.4.0-beta.1"
},
"peerDependencies": {
"@harlem/core": "^2.0.0"
},
Expand Down
10 changes: 1 addition & 9 deletions extensions/transaction/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import snapshotExtension from '@harlem/extension-snapshot';

import {
EVENTS,
MUTATIONS,
Expand All @@ -26,17 +24,11 @@ export default function transactionExtension<TState extends BaseState>() {
return (store: InternalStore<TState>) => {
store.register('extensions', 'transaction', () => 'No options specified');

const {
snapshot,
} = snapshotExtension({
mutationName: MUTATIONS.rollback,
})(store);

function transaction<TPayload>(name: string, transactor: Transactor<TState, TPayload>): Transaction<TPayload> {
const mutate = (mutator: Mutator<TState, undefined, void>) => store.write(name, SENDER, mutator);

return ((payload: TPayload) => {
const snap = snapshot();
const snap = store.snapshot();

const emit = (event: string) => store.emit(event, SENDER, {
transaction: name,
Expand Down
3 changes: 1 addition & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ __metadata:
languageName: unknown
linkType: soft

"@harlem/extension-snapshot@^2.4.0-beta.1, @harlem/extension-snapshot@workspace:extensions/snapshot":
"@harlem/extension-snapshot@workspace:extensions/snapshot":
version: 0.0.0-use.local
resolution: "@harlem/extension-snapshot@workspace:extensions/snapshot"
dependencies:
Expand Down Expand Up @@ -1006,7 +1006,6 @@ __metadata:
resolution: "@harlem/extension-transaction@workspace:extensions/transaction"
dependencies:
"@harlem/core": ^2.4.0-beta.1
"@harlem/extension-snapshot": ^2.4.0-beta.1
peerDependencies:
"@harlem/core": ^2.0.0
languageName: unknown
Expand Down

0 comments on commit d715465

Please sign in to comment.