Skip to content

Commit

Permalink
refactor autosave types
Browse files Browse the repository at this point in the history
  • Loading branch information
ivandotv committed Jul 1, 2022
1 parent 35cc2b8 commit ebee7da
Show file tree
Hide file tree
Showing 4 changed files with 314 additions and 39 deletions.
6 changes: 6 additions & 0 deletions .changeset/blue-toys-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@fuerte/core': major
---

refactor exported Typescript types
refactor `AutosaveCollectionConfig`
2 changes: 1 addition & 1 deletion packages/core/src/collection/AutosaveCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class AutosaveCollection<
this.config.autoSave = {
enabled: false,
debounce: 0,
...(config?.autoSave ? config.autoSave : undefined)
...(config?.autoSave || undefined)
}
}

Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/collection/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,23 @@ import {
} from '../types'
import { ASYNC_STATUS, isPromise, wrapInArray } from '../utils'

/** Dupicate model strategies*/
export const DuplicateModelStrategy = {
/** keep the new model*/
KEEP_NEW: 'KEEP_NEW',
/** keep the old model*/
KEEP_OLD: 'KEEP_OLD',
/** use compare function*/
COMPARE: 'COMPARE'
} as const

/** Model compare results*/
export const ModelCompareResult = {
/** keep the new model*/
KEEP_NEW: 'KEEP_NEW',
/** keep the old model*/
KEEP_OLD: 'KEEP_OLD',
/** keep both models. Make sure they have different identities*/
KEEP_BOTH: 'KEEP_BOTH'
} as const

Expand Down
Loading

0 comments on commit ebee7da

Please sign in to comment.