Skip to content

Commit 2fdf462

Browse files
committed
style: 💄 run Prettier
1 parent 4e5bcee commit 2fdf462

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

src/__demos__/block-sync-ui/main.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {JsonCrdtRepo} from '../../json-crdt-repo/JsonCrdtRepo';
44
import {ClickableJsonCrdt} from 'clickable-json';
55
import {Model, Patch} from 'json-joy/lib/json-crdt';
66

7+
/* tslint:disable no-console */
8+
79
const repo = new JsonCrdtRepo({
810
wsUrl: 'wss://demo-iasd8921ondk0.jsonjoy.com/rpc',
911
});
@@ -35,15 +37,23 @@ const Demo: React.FC = () => {
3537
<div style={{padding: 32}}>
3638
<ClickableJsonCrdt model={model} showRoot />
3739
<hr />
38-
<button onClick={async () => {
39-
const {block} = await repo.remote.read(id);
40-
const model = Model.fromBinary(block.snapshot.blob);
41-
for (const batch of block.tip)
42-
for (const patch of batch.patches) model.applyPatch(Patch.fromBinary(patch.blob));
43-
setRemote(model);
44-
}}>Load remote state</button>
40+
<button
41+
onClick={async () => {
42+
const {block} = await repo.remote.read(id);
43+
const model = Model.fromBinary(block.snapshot.blob);
44+
for (const batch of block.tip)
45+
for (const patch of batch.patches) model.applyPatch(Patch.fromBinary(patch.blob));
46+
setRemote(model);
47+
}}
48+
>
49+
Load remote state
50+
</button>
4551
<br />
46-
{!!remote && <code style={{fontSize: 8}}><pre>{remote.toString()}</pre></code>}
52+
{!!remote && (
53+
<code style={{fontSize: 8}}>
54+
<pre>{remote.toString()}</pre>
55+
</code>
56+
)}
4757
</div>
4858
);
4959
};

src/browser/createBinaryWsRpcClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import {BinaryRpcMessageCodec} from '../common/codec/binary';
77

88
/**
99
* Constructs a JSON Reactive RPC client.
10-
*
10+
*
1111
* ```typescript
1212
* const client = createJsonWsRpcClient('wss://api.host.com', 'token');
1313
* ```
14-
*
14+
*
1515
* @param url RPC endpoint.
1616
* @param token Authentication token.
1717
* @returns An RPC client.

src/json-crdt-repo/local/level/LevelLocalRepo.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ export class LevelLocalRepo implements LocalRepo {
351351
protected async readMeta(keyBase: string): Promise<BlockMeta> {
352352
const metaKey = keyBase + Defaults.Metadata;
353353
const blob = await this.kv.get(metaKey);
354-
const meta = await this.decode(blob, false) as BlockMeta;
354+
const meta = (await this.decode(blob, false)) as BlockMeta;
355355
return meta;
356356
}
357357

@@ -396,7 +396,8 @@ export class LevelLocalRepo implements LocalRepo {
396396
public async readFrontierTip(keyBase: string): Promise<Patch | undefined> {
397397
const frontierBase = this.frontierKeyBase(keyBase);
398398
const lte = frontierBase + `~`;
399-
for await (const blob of this.kv.values({lte, limit: 1, reverse: true})) return Patch.fromBinary(await this.decrypt(blob, false));
399+
for await (const blob of this.kv.values({lte, limit: 1, reverse: true}))
400+
return Patch.fromBinary(await this.decrypt(blob, false));
400401
return;
401402
}
402403

@@ -563,8 +564,7 @@ export class LevelLocalRepo implements LocalRepo {
563564
protected async *listDirty(): AsyncIterableIterator<BlockSyncRecord> {
564565
const gt: string = Defaults.SyncRoot;
565566
const lt: string = Defaults.SyncRoot + '~';
566-
for await (const blob of this.kv.values({gt, lt}))
567-
yield await this.decode(blob, false) as BlockSyncRecord;
567+
for await (const blob of this.kv.values({gt, lt})) yield (await this.decode(blob, false)) as BlockSyncRecord;
568568
}
569569

570570
public async remoteSyncAll(): Promise<SyncResult[]> {

0 commit comments

Comments
 (0)