[READ-ONLY] Mirror of https://github.com/improsocial/impro An extensible Bluesky client for web impro.social
6

Configure Feed

Select the types of activity you want to include in your feed.

Handle missing facet features

Grace Kind (Jul 17, 2026, 3:00 PM -0500) b3e8374e 8864d4e2

+35 -3
+1 -1
package.json
··· 1 1 { 2 2 "name": "impro", 3 - "version": "0.17.191", 3 + "version": "0.17.192", 4 4 "type": "module", 5 5 "scripts": { 6 6 "start": "rm -rf \"${BUILD_DIR:-build}\" && NODE_ENV=development eleventy --serve",
+6 -2
src/js/facetHelpers.js
··· 149 149 const unresolvedMentions = []; 150 150 for (const facet of facets) { 151 151 // Only handle one feature for now 152 - const feature = facet.features[0]; 152 + const feature = facet.features?.[0]; 153 + if (!feature) { 154 + resolvedFacets.push(facet); 155 + continue; 156 + } 153 157 if (feature.$type === "app.bsky.richtext.facet#mention" && !feature.did) { 154 158 unresolvedMentions.push(facet); 155 159 } else { ··· 203 207 204 208 export function getTagsFromFacets(facets) { 205 209 return facets.filter( 206 - (facet) => facet.features[0].$type === "app.bsky.richtext.facet#tag", 210 + (facet) => facet.features?.[0]?.$type === "app.bsky.richtext.facet#tag", 207 211 ); 208 212 } 209 213
+28
tests/unit/specs/facetHelpers.test.js
··· 354 354 assert.deepEqual(resolved.length, 0); 355 355 }); 356 356 357 + it("should pass through facets with no features", async () => { 358 + const facets = [ 359 + { index: { byteStart: 0, byteEnd: 5 } }, 360 + { index: { byteStart: 6, byteEnd: 10 }, features: [] }, 361 + ]; 362 + 363 + const resolver = createMockIdentityResolver(); 364 + const resolved = await resolveFacets(facets, resolver); 365 + 366 + assert.deepEqual(resolved, facets); 367 + }); 368 + 357 369 it("should handle mixed resolved and unresolved mentions", async () => { 358 370 const facets = [ 359 371 { ··· 475 487 const tags = getTagsFromFacets([]); 476 488 477 489 assert.deepEqual(tags.length, 0); 490 + }); 491 + 492 + it("should skip facets with no features", () => { 493 + const facets = [ 494 + { index: { byteStart: 0, byteEnd: 5 } }, 495 + { index: { byteStart: 6, byteEnd: 10 }, features: [] }, 496 + { 497 + index: { byteStart: 12, byteEnd: 17 }, 498 + features: [{ $type: "app.bsky.richtext.facet#tag", tag: "hello" }], 499 + }, 500 + ]; 501 + 502 + const tags = getTagsFromFacets(facets); 503 + 504 + assert.deepEqual(tags.length, 1); 505 + assert.deepEqual(tags[0].features[0].tag, "hello"); 478 506 }); 479 507 480 508 it("should filter out mentions", () => {