mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 10:45:57 +00:00
chore(automerge): add lib again
This commit is contained in:
parent
54a7d9f52d
commit
4934e7b0f5
4 changed files with 39 additions and 11 deletions
|
|
@ -121,6 +121,7 @@
|
|||
"all-contributors-cli": "^6.8.0",
|
||||
"angular-material-css-vars": "^0.3.7",
|
||||
"angular2-promise-buttons": "latest",
|
||||
"automerge": "^0.14.0",
|
||||
"chart.js": "^2.8.0",
|
||||
"clipboard": "^2.0.1",
|
||||
"codelyzer": "^5.1.2",
|
||||
|
|
|
|||
|
|
@ -474,10 +474,7 @@ export class PersistenceService {
|
|||
console.log('----------------------------------------------------------------');
|
||||
console.log(dbKey, actionName, this._automergeCache[dbKey]);
|
||||
if (!this._automergeCache[dbKey]) {
|
||||
this._automergeCache[dbKey] = Automerge.from(
|
||||
data,
|
||||
{actorId: this._getActor()},
|
||||
);
|
||||
this._automergeCache[dbKey] = Automerge.from(data, this._getActor());
|
||||
console.log('INIT IN SAVE', this._automergeCache[dbKey]);
|
||||
}
|
||||
|
||||
|
|
@ -518,18 +515,23 @@ export class PersistenceService {
|
|||
private async _loadFromDb(key: string): Promise<any> {
|
||||
if (!this._automergeCache[key]) {
|
||||
const data = await this._databaseService.load(key);
|
||||
console.log(key);
|
||||
|
||||
if (key !== 'TAG_STATE' && key !== 'TASKS_STATE') {
|
||||
if ((key !== 'TAG_STATE' && key !== 'TASKS_STATE')) {
|
||||
return data || undefined;
|
||||
}
|
||||
if (data) {
|
||||
console.log(key, data);
|
||||
|
||||
if (!data) {
|
||||
return undefined;
|
||||
} else if (typeof data === 'string') {
|
||||
this._automergeCache[key] = Automerge.load(data, this._getActor());
|
||||
console.log('INIT_IN_LOAD--', key, this._automergeCache[key]);
|
||||
console.log(Automerge.getHistory(this._automergeCache[key]).map(state => [state.change.message]));
|
||||
return this._automergeCache[key];
|
||||
} else {
|
||||
this._automergeCache[key] = Automerge.from(data, this._getActor());
|
||||
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// NOTE: we use undefined as null does not trigger default function arguments
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export class TagEffects {
|
|||
TaskActionTypes.DeleteMainTasks,
|
||||
TaskActionTypes.UpdateTaskTags,
|
||||
),
|
||||
switchMap(() => this._saveToLs$),
|
||||
switchMap((a) => this._saveToLs$(a)),
|
||||
), {dispatch: false});
|
||||
|
||||
updateProjectStorageConditionalTask$ = createEffect(() => this._actions$.pipe(
|
||||
|
|
@ -95,7 +95,7 @@ export class TagEffects {
|
|||
? of(a)
|
||||
: EMPTY;
|
||||
}),
|
||||
switchMap(() => this._saveToLs$),
|
||||
switchMap((a) => this._saveToLs$(a)),
|
||||
), {dispatch: false});
|
||||
|
||||
updateTagsStorageConditional$ = createEffect(() => this._actions$.pipe(
|
||||
|
|
|
|||
27
yarn.lock
27
yarn.lock
|
|
@ -2026,6 +2026,16 @@ atob@^2.1.2:
|
|||
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
|
||||
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
|
||||
|
||||
automerge@^0.14.0:
|
||||
version "0.14.0"
|
||||
resolved "https://registry.yarnpkg.com/automerge/-/automerge-0.14.0.tgz#cdee150385415812eb39d58a25bd9b74a46e0a8b"
|
||||
integrity sha512-H0Lszio1ZywPpJ3bS8IZ8qGkmFYN/cLPXT30AD1gDz7LMd6NEhdbOA+uBLr97a4M4f3Xx0KtOAJrQ7Xjo4OCOQ==
|
||||
dependencies:
|
||||
immutable "^3.8.2"
|
||||
transit-immutable-js "^0.7.0"
|
||||
transit-js "^0.8.861"
|
||||
uuid "^3.4.0"
|
||||
|
||||
autoprefixer@9.7.4:
|
||||
version "9.7.4"
|
||||
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.7.4.tgz#f8bf3e06707d047f0641d87aee8cfb174b2a5378"
|
||||
|
|
@ -5821,6 +5831,11 @@ immediate@~3.0.5:
|
|||
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
|
||||
integrity sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=
|
||||
|
||||
immutable@^3.8.2:
|
||||
version "3.8.2"
|
||||
resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3"
|
||||
integrity sha1-wkOZUUVbs5kT2vKBN28VMOEErfM=
|
||||
|
||||
import-cwd@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9"
|
||||
|
|
@ -11033,6 +11048,16 @@ tough-cookie@~2.5.0:
|
|||
psl "^1.1.28"
|
||||
punycode "^2.1.1"
|
||||
|
||||
transit-immutable-js@^0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/transit-immutable-js/-/transit-immutable-js-0.7.0.tgz#993e25089b6311ff402140f556276d6d253005d9"
|
||||
integrity sha1-mT4lCJtjEf9AIUD1VidtbSUwBdk=
|
||||
|
||||
transit-js@^0.8.861:
|
||||
version "0.8.861"
|
||||
resolved "https://registry.yarnpkg.com/transit-js/-/transit-js-0.8.861.tgz#829e516b80349a41fff5d59f5e6993b5473f72c9"
|
||||
integrity sha512-4O9OrYPZw6C0M5gMTvaeOp+xYz6EF79JsyxIvqXHlt+pisSrioJWFOE80N8aCPoJLcNaXF442RZrVtdmd4wkDQ==
|
||||
|
||||
tree-kill@1.2.2:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
|
||||
|
|
@ -11443,7 +11468,7 @@ uuid@7.0.2:
|
|||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.2.tgz#7ff5c203467e91f5e0d85cfcbaaf7d2ebbca9be6"
|
||||
integrity sha512-vy9V/+pKG+5ZTYKf+VcphF5Oc6EFiu3W8Nv3P3zIh0EqVI80ZxOzuPfe9EHjkFNvf8+xuTHVeei4Drydlx4zjw==
|
||||
|
||||
uuid@^3.0.0, uuid@^3.0.1, uuid@^3.3.2:
|
||||
uuid@^3.0.0, uuid@^3.0.1, uuid@^3.3.2, uuid@^3.4.0:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
||||
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue