Title: Clarity around getPersisted returning undefined · Issue #161 · tinyplex/tinybase · GitHub
Open Graph Title: Clarity around getPersisted returning undefined · Issue #161 · tinyplex/tinybase
X Title: Clarity around getPersisted returning undefined · Issue #161 · tinyplex/tinybase
Description: Describe the bug Hi. Thank you for a great project. I am working on another persister and stumbled onto a small issue. The type of createCustomPersister's getPersisted parameter permits returning Promise
Open Graph Description: Describe the bug Hi. Thank you for a great project. I am working on another persister and stumbled onto a small issue. The type of createCustomPersister's getPersisted parameter permits returning P...
X Description: Describe the bug Hi. Thank you for a great project. I am working on another persister and stumbled onto a small issue. The type of createCustomPersister's getPersisted parameter permits returni...
Opengraph URL: https://github.com/tinyplex/tinybase/issues/161
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Clarity around getPersisted returning undefined","articleBody":"### Describe the bug\r\n\r\nHi. Thank you for a great project. I am working on another persister and stumbled onto a small issue.\r\n\r\nThe type of `createCustomPersister`'s [`getPersisted` parameter](https://github.com/tinyplex/tinybase/blob/2f3e053c6d4aba24e6568787f0e2b4caa23c7ebd/src/persisters/index.ts#L81) permits returning `Promise\u003cundefined\u003e`, but during the `load()` the type of returned value is coerced ([in `setContentOrChanges`](https://github.com/tinyplex/tinybase/blob/2f3e053c6d4aba24e6568787f0e2b4caa23c7ebd/src/persisters/index.ts#L151)) skipping the check for `undefined` which results in e.g. `store.setContent` failing like this:\r\n\r\n```\r\nGot TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))\r\n at setContent (...../tinybase/5.0.3/index.js:2934:22)\r\n at setContentOrChanges (...../tinybase/5.0.3/index.js:1223:28)\r\n .....\r\n```","author":{"url":"https://github.com/wattroll","@type":"Person","name":"wattroll"},"datePublished":"2024-07-16T11:19:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/161/tinybase/issues/161"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:054db31a-9591-d2f8-5c5d-4383e5844052 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A436:12A6C9:A380BC:EB5D25:6A4E4580 |
| html-safe-nonce | 9c4694c3ecd610b1463a37aee4fa60e0375f6ee6763d7c503a471aebf30fe471 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDM2OjEyQTZDOTpBMzgwQkM6RUI1RDI1OjZBNEU0NTgwIiwidmlzaXRvcl9pZCI6Ijc0Mjc4Mjk5NDY1ODY2NDU4ODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 822f2c99ef7902a40501c183b758e31f2578256a0a093feeedcd0daeda024f1d |
| hovercard-subject-tag | issue:2410886908 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/tinyplex/tinybase/161/issue_layout |
| twitter:image | https://opengraph.githubassets.com/89aa2078fb43148fab8895629c7b41fb967ce304bdb586c7ec1c7b49ab146667/tinyplex/tinybase/issues/161 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/89aa2078fb43148fab8895629c7b41fb967ce304bdb586c7ec1c7b49ab146667/tinyplex/tinybase/issues/161 |
| og:image:alt | Describe the bug Hi. Thank you for a great project. I am working on another persister and stumbled onto a small issue. The type of createCustomPersister's getPersisted parameter permits returning P... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wattroll |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/tinyplex/tinybase git https://github.com/tinyplex/tinybase.git |
| octolytics-dimension-user_id | 96894742 |
| octolytics-dimension-user_login | tinyplex |
| octolytics-dimension-repository_id | 443220240 |
| octolytics-dimension-repository_nwo | tinyplex/tinybase |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 443220240 |
| octolytics-dimension-repository_network_root_nwo | tinyplex/tinybase |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9fabff9b8b127e686a3ec86f91422e818056ca2c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width