@devvit/ui-renderer 0.10.15-next-2024-02-14-08faeb14a.0 → 0.10.15-next-2024-02-14-48cb30392.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,7 +71,6 @@ export declare class DevvitCustomPost extends LitElement {
71
71
  disconnectedCallback(): void;
72
72
  rerender(): void;
73
73
  static get styles(): import("lit").CSSResult[];
74
- suspendPost(): void;
75
74
  protected render(): import("lit-html").TemplateResult<1>;
76
75
  protected willUpdate(props: PropertyValues<this>): Promise<void>;
77
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"devvit-custom-post.d.ts","sourceRoot":"","sources":["../../library/src/client/devvit-custom-post.ts"],"names":[],"mappings":"AAAA,OAAO,kEAAkE,CAAC;AAE1E,OAAO,KAAK,EAEV,WAAW,EAGX,MAAM,EAGN,YAAY,EACZ,QAAQ,EAER,kBAAkB,EAClB,MAAM,EACN,OAAO,EAER,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAOL,aAAa,EAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,eAAe,EAChB,MAAM,kDAAkD,CAAC;AAG1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAQ,MAAM,KAAK,CAAC;AASvD,OAAO,gDAAgD,CAAC;AACxD,OAAO,+CAA+C,CAAC;AACvD,OAAO,8BAA8B,CAAC;AAEtC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;IACD,UAAU,mBAAmB;QAC3B,sBAAsB,EAAE,uBAAuB,CAAC;QAChD,kBAAkB,EAAE,mBAAmB,CAAC;QACxC,iBAAiB,EAAE,cAAc,CAAC,iBAAiB,CAAC,GAAG;YAAE,MAAM,EAAE,aAA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,GAAG,OAAO,GAAG,SAAS,CAAC;IAEzE,qBAAqB,EAAE,OAAO,CAAS;IACgB,UAAU,EAAE,OAAO,CAAQ;IACzE,cAAc,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAGxB,OAAO,CAAC,eAAe,CAAwB;IAGvE,OAAO,CAAC,YAAY,CAAkB;IAItC,OAAO,CAAC,UAAU,CAAC,CAAQ;;IAY3B,oBAAoB,IAAI,IAAI;IAKrC,QAAQ,IAAI,IAAI;IAIhB,WAAoB,MAAM,8BAEzB;cAEkB,MAAM;cAoBA,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAgPhF"}
@@ -18,11 +18,11 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
18
18
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
19
19
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
20
20
  };
21
- var _DevvitCustomPost_instances, _DevvitCustomPost_appState, _DevvitCustomPost_customPostActor, _DevvitCustomPost_hasInitialRender, _DevvitCustomPost_lastRequest, _DevvitCustomPost_localClient, _DevvitCustomPost_rerenderTimeout, _DevvitCustomPost_rootHeight, _DevvitCustomPost_rpcQueue, _DevvitCustomPost_uiEventHandlerActor, _DevvitCustomPost_bubble, _DevvitCustomPost_effectEventRender, _DevvitCustomPost_handleEffects, _DevvitCustomPost_handleUserAction, _DevvitCustomPost_initialRender, _DevvitCustomPost_makeRenderContext, _DevvitCustomPost_newRenderRequest, _DevvitCustomPost_onPluginCall, _DevvitCustomPost_processEvent, _DevvitCustomPost_queueEvent, _DevvitCustomPost_queueRenderPost, _DevvitCustomPost_renderPost, _DevvitCustomPost_state_get, _DevvitCustomPost_userActionRender;
21
+ var _DevvitCustomPost_instances, _DevvitCustomPost_appState, _DevvitCustomPost_customPostActor, _DevvitCustomPost_hasInitialRender, _DevvitCustomPost_lastRequest, _DevvitCustomPost_localClient, _DevvitCustomPost_rerenderTimeout, _DevvitCustomPost_rootHeight, _DevvitCustomPost_rpcQueue, _DevvitCustomPost_uiEventHandlerActor, _DevvitCustomPost_bubble, _DevvitCustomPost_effectEventRender, _DevvitCustomPost_handleEffects, _DevvitCustomPost_handleUserAction, _DevvitCustomPost_initialRender, _DevvitCustomPost_makeRenderContext, _DevvitCustomPost_newRenderRequest, _DevvitCustomPost_onPluginCall, _DevvitCustomPost_processEvent, _DevvitCustomPost_queueEvent, _DevvitCustomPost_queueRenderPost, _DevvitCustomPost_renderPost, _DevvitCustomPost_state_get, _DevvitCustomPost_suspendPost, _DevvitCustomPost_userActionRender;
22
22
  import '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
23
23
  import { BlockConfig_Root, BlockRenderEventType, BlockStackDirection, CustomPostDefinition, EffectType, RealtimeDefinition, UIEventHandlerDefinition, } from '@devvit/protos';
24
24
  import { BrowserLiteClient, } from '@devvit/runtime-lite/client/BrowserLiteClient.js';
25
- import { isCircuitBreaker } from '@devvit/runtime-lite/types/CircuitBreaker.js';
25
+ import { isCircuitBreaker, } from '@devvit/runtime-lite/types/CircuitBreaker.js';
26
26
  import { customEvent } from '@reddit/faceplate/lib/custom-event.js';
27
27
  import { LitElement, html } from 'lit';
28
28
  import { customElement, property, query, state } from 'lit/decorators.js';
@@ -92,7 +92,7 @@ let DevvitCustomPost = class DevvitCustomPost extends LitElement {
92
92
  this.addEventListener('devvit-user-action', __classPrivateFieldGet(this, _DevvitCustomPost_handleUserAction, "f"));
93
93
  }
94
94
  disconnectedCallback() {
95
- this.suspendPost();
95
+ __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_suspendPost).call(this);
96
96
  super.disconnectedCallback();
97
97
  }
98
98
  rerender() {
@@ -101,13 +101,6 @@ let DevvitCustomPost = class DevvitCustomPost extends LitElement {
101
101
  static get styles() {
102
102
  return [styles];
103
103
  }
104
- suspendPost() {
105
- this._isSuspended = true;
106
- if (__classPrivateFieldGet(this, _DevvitCustomPost_rerenderTimeout, "f") !== undefined) {
107
- window.clearTimeout(__classPrivateFieldGet(this, _DevvitCustomPost_rerenderTimeout, "f"));
108
- }
109
- __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.quit();
110
- }
111
104
  render() {
112
105
  if (!this.renderResponse) {
113
106
  // The slot content is considered the loading state.
@@ -129,10 +122,7 @@ let DevvitCustomPost = class DevvitCustomPost extends LitElement {
129
122
  async willUpdate(props) {
130
123
  if (props.has('localRuntimeCode') && this.localRuntimeCode) {
131
124
  __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.quit();
132
- __classPrivateFieldSet(this, _DevvitCustomPost_localClient, new BrowserLiteClient(this.localRuntimeCode, undefined, {
133
- callback: __classPrivateFieldGet(this, _DevvitCustomPost_onPluginCall, "f"),
134
- plugins: [RealtimeDefinition.fullName],
135
- }), "f");
125
+ __classPrivateFieldSet(this, _DevvitCustomPost_localClient, new BrowserLiteClient(this.localRuntimeCode, (type, err) => __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_bubble).call(this, 'devvit-ui-error', { type, err }), { callback: __classPrivateFieldGet(this, _DevvitCustomPost_onPluginCall, "f"), plugins: [RealtimeDefinition.fullName] }), "f");
136
126
  }
137
127
  const actorRefChanged = props.has('actorRef');
138
128
  if (actorRefChanged) {
@@ -144,7 +134,13 @@ let DevvitCustomPost = class DevvitCustomPost extends LitElement {
144
134
  if ((this.actorRef && (actorRefChanged || props.has('bundle'))) || props.has('useSandbox')) {
145
135
  if (this.bundle) {
146
136
  // offline/online, defer initialRender for offline client
147
- await __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.loadBundle(this.bundle, this.useSandbox);
137
+ try {
138
+ await __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.loadBundle(this.bundle, this.useSandbox);
139
+ }
140
+ catch (err) {
141
+ __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_bubble).call(this, 'devvit-ui-error', { type: 'Error', err });
142
+ throw err;
143
+ }
148
144
  }
149
145
  else if ((this.bundle && props.has('bundle')) || !__classPrivateFieldGet(this, _DevvitCustomPost_hasInitialRender, "f")) {
150
146
  // online only
@@ -175,8 +171,7 @@ _DevvitCustomPost_bubble = function _DevvitCustomPost_bubble(type, detail) {
175
171
  this.dispatchEvent(customEvent(type, detail));
176
172
  };
177
173
  _DevvitCustomPost_effectEventRender = async function _DevvitCustomPost_effectEventRender(effectType, effectData) {
178
- await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_newRenderRequest, "f").call(this, BlockRenderEventType.RENDER_EFFECT_EVENT, effectType, effectData), 'CircuitClose' // eslint-disable-line @reddit/i18n-shreddit/no-unwrapped-strings
179
- );
174
+ await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_newRenderRequest, "f").call(this, BlockRenderEventType.RENDER_EFFECT_EVENT, effectType, effectData), undefined);
180
175
  };
181
176
  _DevvitCustomPost_handleEffects = async function _DevvitCustomPost_handleEffects(renderType, effects) {
182
177
  effects.forEach((effect) => {
@@ -204,8 +199,7 @@ _DevvitCustomPost_initialRender = function _DevvitCustomPost_initialRender() {
204
199
  }
205
200
  __classPrivateFieldSet(this, _DevvitCustomPost_rootHeight, undefined, "f");
206
201
  __classPrivateFieldSet(this, _DevvitCustomPost_hasInitialRender, true, "f");
207
- __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_newRenderRequest, "f").call(this, BlockRenderEventType.RENDER_INITIAL), 'CircuitClose' // eslint-disable-line @reddit/i18n-shreddit/no-unwrapped-strings
208
- );
202
+ __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_newRenderRequest, "f").call(this, BlockRenderEventType.RENDER_INITIAL), undefined);
209
203
  };
210
204
  _DevvitCustomPost_processEvent = async function _DevvitCustomPost_processEvent(ev) {
211
205
  const req = {
@@ -216,16 +210,23 @@ _DevvitCustomPost_processEvent = async function _DevvitCustomPost_processEvent(e
216
210
  try {
217
211
  call = (await __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.call('HandleUIEvent', req, this.metadata));
218
212
  }
219
- catch (e) {
220
- if (!isCircuitBreaker(e) && __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.ready) {
221
- console.error(e);
213
+ catch (err) {
214
+ if (!isCircuitBreaker(err) && __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.ready) {
215
+ console.error(err);
216
+ __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_bubble).call(this, 'devvit-ui-error', { err, type: 'Error' });
222
217
  }
223
218
  else {
224
219
  if (devvit?.logCircuitBreaks)
225
- console.warn('remote call triggered at', e);
220
+ console.warn('remote call triggered at', err);
226
221
  }
227
222
  // Call remote runtime.
228
- call = await __classPrivateFieldGet(this, _DevvitCustomPost_uiEventHandlerActor, "f")?.HandleUIEvent(req, this.metadata);
223
+ try {
224
+ call = await __classPrivateFieldGet(this, _DevvitCustomPost_uiEventHandlerActor, "f")?.HandleUIEvent(req, this.metadata);
225
+ }
226
+ catch (err) {
227
+ __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_bubble).call(this, 'devvit-ui-error', { err, type: 'Error' });
228
+ throw err;
229
+ }
229
230
  }
230
231
  if (call) {
231
232
  const res = await call;
@@ -236,39 +237,47 @@ _DevvitCustomPost_processEvent = async function _DevvitCustomPost_processEvent(e
236
237
  await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_handleEffects).call(this, renderType, res.effects);
237
238
  }
238
239
  };
239
- _DevvitCustomPost_queueRenderPost = function _DevvitCustomPost_queueRenderPost(req, circuit) {
240
- void __classPrivateFieldGet(this, _DevvitCustomPost_rpcQueue, "f").add(() => __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_renderPost).call(this, req, circuit),
240
+ _DevvitCustomPost_queueRenderPost = function _DevvitCustomPost_queueRenderPost(req, circuitBreak) {
241
+ void __classPrivateFieldGet(this, _DevvitCustomPost_rpcQueue, "f").add(() => __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_renderPost).call(this, req, circuitBreak),
241
242
  // Cut in line to re-render from server response immediately
242
- { priority: circuit === 'CircuitBreak' ? 100 : 0 });
243
+ { priority: circuitBreak ? 100 : 0 });
243
244
  };
244
- _DevvitCustomPost_renderPost = async function _DevvitCustomPost_renderPost(req, circuit) {
245
+ _DevvitCustomPost_renderPost = async function _DevvitCustomPost_renderPost(req, circuitBreak) {
245
246
  var _a, _b;
246
247
  let call;
247
248
  req.state = __classPrivateFieldGet(this, _DevvitCustomPost_instances, "a", _DevvitCustomPost_state_get);
248
249
  try {
249
- if (circuit === 'CircuitBreak') {
250
- throw new Error();
251
- }
250
+ if (circuitBreak)
251
+ throw circuitBreak;
252
252
  call = (await __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.call('RenderPost', req, this.metadata));
253
253
  }
254
- catch (e) {
255
- if (isCircuitBreaker(e)) {
256
- if (e.response) {
257
- call = e.response;
254
+ catch (err) {
255
+ // Local runtime call failed.
256
+ if (!circuitBreak && isCircuitBreaker(err)) {
257
+ // Circuit break. Enqueue remote runtime render.
258
+ if (err.response) {
259
+ call = err.response;
258
260
  }
259
- __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, req, 'CircuitBreak' // eslint-disable-line @reddit/i18n-shreddit/no-unwrapped-strings
260
- );
261
+ __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, req, err);
261
262
  }
262
263
  else {
263
- if (circuit === 'CircuitClose' && __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.ready) {
264
- console.error(e);
264
+ // Render now.
265
+ if (!circuitBreak && __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.ready) {
266
+ __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_bubble).call(this, 'devvit-ui-error', { err, type: 'Error' });
267
+ console.error(err);
265
268
  }
266
269
  else {
267
270
  if (devvit?.logCircuitBreaks)
268
- console.warn('remote call triggered at', e);
271
+ console.warn('remote call triggered at', err);
269
272
  }
270
273
  // Call remote runtime.
271
- call = await __classPrivateFieldGet(this, _DevvitCustomPost_customPostActor, "f")?.RenderPost(req, this.metadata);
274
+ try {
275
+ call = await __classPrivateFieldGet(this, _DevvitCustomPost_customPostActor, "f")?.RenderPost(req, this.metadata);
276
+ }
277
+ catch (err) {
278
+ __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_bubble).call(this, 'devvit-ui-error', { err, type: 'Error' });
279
+ throw err;
280
+ }
272
281
  }
273
282
  }
274
283
  if (call) {
@@ -297,9 +306,14 @@ _DevvitCustomPost_state_get = function _DevvitCustomPost_state_get() {
297
306
  const data = { __postData: { thingId: this.postId, config: this.postConfig } };
298
307
  return Object.assign({}, __classPrivateFieldGet(this, _DevvitCustomPost_appState, "f"), data);
299
308
  };
309
+ _DevvitCustomPost_suspendPost = function _DevvitCustomPost_suspendPost() {
310
+ this._isSuspended = true;
311
+ if (__classPrivateFieldGet(this, _DevvitCustomPost_rerenderTimeout, "f") != null)
312
+ clearTimeout(__classPrivateFieldGet(this, _DevvitCustomPost_rerenderTimeout, "f"));
313
+ __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.quit();
314
+ };
300
315
  _DevvitCustomPost_userActionRender = async function _DevvitCustomPost_userActionRender(actionId, data = {}) {
301
- await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_newRenderRequest, "f").call(this, BlockRenderEventType.RENDER_USER_ACTION, actionId, data), 'CircuitClose' // eslint-disable-line @reddit/i18n-shreddit/no-unwrapped-strings
302
- );
316
+ await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_newRenderRequest, "f").call(this, BlockRenderEventType.RENDER_USER_ACTION, actionId, data), undefined);
303
317
  };
304
318
  __decorate([
305
319
  property({ attribute: false }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/ui-renderer",
3
- "version": "0.10.15-next-2024-02-14-08faeb14a.0",
3
+ "version": "0.10.15-next-2024-02-14-48cb30392.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,10 +54,10 @@
54
54
  },
55
55
  "types": "./index.d.ts",
56
56
  "dependencies": {
57
- "@devvit/protos": "0.10.15-next-2024-02-14-08faeb14a.0",
58
- "@devvit/runtime-lite": "0.10.15-next-2024-02-14-08faeb14a.0",
59
- "@devvit/runtimes": "0.10.15-next-2024-02-14-08faeb14a.0",
60
- "@devvit/shared-types": "0.10.15-next-2024-02-14-08faeb14a.0",
57
+ "@devvit/protos": "0.10.15-next-2024-02-14-48cb30392.0",
58
+ "@devvit/runtime-lite": "0.10.15-next-2024-02-14-48cb30392.0",
59
+ "@devvit/runtimes": "0.10.15-next-2024-02-14-48cb30392.0",
60
+ "@devvit/shared-types": "0.10.15-next-2024-02-14-48cb30392.0",
61
61
  "@dotlottie/player-component": "2.7.2",
62
62
  "p-queue": "7.3.4",
63
63
  "rxjs": "7.5.7"
@@ -84,7 +84,7 @@
84
84
  "devDependencies": {
85
85
  "@devvit/eslint-config": "0.10.14",
86
86
  "@devvit/repo-tools": "0.10.14",
87
- "@devvit/tsconfig": "0.10.15-next-2024-02-14-08faeb14a.0",
87
+ "@devvit/tsconfig": "0.10.15-next-2024-02-14-48cb30392.0",
88
88
  "@lit-labs/ssr": "^2.2.3",
89
89
  "@lit/localize": "0.11.4",
90
90
  "@open-wc/testing-helpers": "2.3.0",
@@ -116,5 +116,5 @@
116
116
  "directory": "dist"
117
117
  },
118
118
  "source": "./src/index.ts",
119
- "gitHead": "b16ca50ce404fe0aac5f517cdc611e99a4ba84af"
119
+ "gitHead": "33bb85d21f73987c8391901cbcd53c2b5f34c872"
120
120
  }