Skip to content

Commit 3c44544

Browse files
committed
Make Send request content persist, for Pro users only
1 parent cd5a81f commit 3c44544

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const rulesStore = new RulesStore(accountStore, proxyStore,
8282
}
8383
);
8484
const eventsStore = new EventsStore(proxyStore, apiStore, rulesStore);
85-
const sendStore = new SendStore(eventsStore, rulesStore);
85+
const sendStore = new SendStore(accountStore, eventsStore, rulesStore);
8686

8787
const stores = {
8888
accountStore,

src/model/send/send-store.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { trackEvent } from '../../metrics';
1818

1919
import { EventsStore } from '../events/events-store';
2020
import { RulesStore } from '../rules/rules-store';
21+
import { AccountStore } from '../account/account-store';
2122
import * as ServerApi from '../../services/server-api';
2223

2324
import { HttpExchange } from '../http/exchange';
@@ -33,20 +34,25 @@ import {
3334
export class SendStore {
3435

3536
constructor(
37+
private accountStore: AccountStore,
3638
private eventStore: EventsStore,
3739
private rulesStore: RulesStore
3840
) {}
3941

4042
readonly initialized = lazyObservablePromise(async () => {
4143
await Promise.all([
44+
this.accountStore.initialized,
4245
this.eventStore.initialized,
4346
this.rulesStore.initialized
4447
]);
4548

46-
await hydrate({
47-
key: 'send-store',
48-
store: this
49-
});
49+
if (this.accountStore.mightBePaidUser) {
50+
// For Pro users only, your 'Send' content persists on reload
51+
await hydrate({
52+
key: 'send-store',
53+
store: this
54+
});
55+
}
5056

5157
autorun(() => {
5258
if (this.requestInputs.length === 0) this.addRequestInput();

0 commit comments

Comments
 (0)