Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: psteinroe/supabase-cache-helpers
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: @supabase-cache-helpers/storage-react-query@1.2.3
Choose a base ref
...
head repository: psteinroe/supabase-cache-helpers
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Nov 21, 2024

  1. fix: exports

    psteinroe committed Nov 21, 2024
    Copy the full SHA
    adab01a View commit details
  2. fix: exports

    psteinroe committed Nov 21, 2024
    Copy the full SHA
    8ed14cd View commit details
  3. Merge pull request #534 from psteinroe/fix/exports

    fix: exports
    psteinroe authored Nov 21, 2024
    Copy the full SHA
    d4eed1b View commit details
  4. Copy the full SHA
    13350b3 View commit details
  5. Merge pull request #535 from psteinroe/changeset-release/main

    chore: update versions
    psteinroe authored Nov 21, 2024
    Copy the full SHA
    3b7b0f6 View commit details
  6. Copy the full SHA
    49a35ad View commit details
  7. Merge pull request #536 from psteinroe/chore/update-supabase

    chore: update to latest supabase-js
    psteinroe authored Nov 21, 2024
    Copy the full SHA
    42d9b20 View commit details
  8. Copy the full SHA
    f42bc23 View commit details
  9. Merge pull request #537 from psteinroe/changeset-release/main

    chore: update versions
    psteinroe authored Nov 21, 2024
    Copy the full SHA
    347526e View commit details

Commits on Nov 22, 2024

  1. Copy the full SHA
    e36d439 View commit details
  2. Copy the full SHA
    9ccd8d2 View commit details
  3. Copy the full SHA
    7b6bd28 View commit details

Commits on Nov 23, 2024

  1. Merge pull request #539 from damien-schneider/implement-linked-tabs-c…

    …omponent-and-update-react-query-configuration
    psteinroe authored Nov 23, 2024
    Copy the full SHA
    3325026 View commit details

Commits on Nov 24, 2024

  1. Copy the full SHA
    be89eed View commit details
  2. Copy the full SHA
    21b8f4c View commit details

Commits on Dec 9, 2024

  1. docs: update docs

    boompikachu committed Dec 9, 2024
    Copy the full SHA
    7d6b796 View commit details
  2. Copy the full SHA
    6d84a63 View commit details

Commits on Jan 23, 2025

  1. Copy the full SHA
    0fe5773 View commit details
  2. fix: format

    psteinroe committed Jan 23, 2025
    Copy the full SHA
    931260a View commit details
  3. fix: test

    psteinroe committed Jan 23, 2025
    Copy the full SHA
    267d958 View commit details

Commits on Jan 30, 2025

  1. fix: merge url splitting to unified method that handles self hosted s…

    …ervers as well as managed supabase
    zacharyhansen committed Jan 30, 2025
    Copy the full SHA
    6620dba View commit details
  2. fix: handle rpc

    zacharyhansen committed Jan 30, 2025
    Copy the full SHA
    ae5e761 View commit details
  3. chore: fix formatting

    zacharyhansen committed Jan 30, 2025
    Copy the full SHA
    31153eb View commit details
  4. chore: more formatting

    zacharyhansen committed Jan 30, 2025
    Copy the full SHA
    e8b1438 View commit details
  5. chore: fix formatting

    zacharyhansen committed Jan 30, 2025
    Copy the full SHA
    2900f2e View commit details
  6. chore: fix formatting

    zacharyhansen committed Jan 30, 2025
    Copy the full SHA
    0c61315 View commit details
  7. fix: tablename params

    zacharyhansen committed Jan 30, 2025
    Copy the full SHA
    42ad58f View commit details
  8. chore: add comments

    zacharyhansen committed Jan 30, 2025
    Copy the full SHA
    f20e940 View commit details
  9. chore: spelling

    zacharyhansen committed Jan 30, 2025
    Copy the full SHA
    852f0d3 View commit details
  10. feat: add changeset

    zacharyhansen committed Jan 30, 2025
    Copy the full SHA
    2466274 View commit details

Commits on Jan 31, 2025

  1. Merge pull request #553 from zacharyhansen/fix/support-self-hosted-po…

    …stgrest
    
    fix: merge url splitting to unified method that handles self hosted s…
    psteinroe authored Jan 31, 2025
    Copy the full SHA
    a7a8a19 View commit details
  2. Copy the full SHA
    514aeaf View commit details
  3. Copy the full SHA
    1e18648 View commit details

Commits on Feb 11, 2025

  1. Merge pull request #551 from psteinroe/feat/export-order-by-parser

    feat: export parse order by helper
    psteinroe authored Feb 11, 2025
    Copy the full SHA
    1d579f8 View commit details

Commits on Feb 15, 2025

  1. Update package.json

    juliusmarminge authored Feb 15, 2025
    Copy the full SHA
    3db17ed View commit details

Commits on Feb 24, 2025

  1. Copy the full SHA
    2cef149 View commit details

Commits on Feb 26, 2025

  1. Merge pull request #561 from psteinroe/fix/nested-arrays

    fix(postgrest-core): handle nested arrays properly
    psteinroe authored Feb 26, 2025
    Copy the full SHA
    dbbf677 View commit details
  2. Copy the full SHA
    8776adc View commit details

Commits on Mar 6, 2025

  1. Merge pull request #556 from psteinroe/changeset-release/main

    chore: update versions
    psteinroe authored Mar 6, 2025
    Copy the full SHA
    ac23c32 View commit details

Commits on Mar 12, 2025

  1. chore: docs

    psteinroe committed Mar 12, 2025
    Copy the full SHA
    51f39ae View commit details

Commits on Mar 13, 2025

  1. Copy the full SHA
    0caec5e View commit details
  2. fix: format

    psteinroe committed Mar 13, 2025
    Copy the full SHA
    a933b53 View commit details
  3. fix: tests

    psteinroe committed Mar 13, 2025
    Copy the full SHA
    ca4b6bf View commit details
  4. Merge pull request #564 from psteinroe/feat/revalidate-tables

    feat: add useRevalidateTables hook
    psteinroe authored Mar 13, 2025
    Copy the full SHA
    eb3b8df View commit details
  5. Copy the full SHA
    e3b9e22 View commit details
  6. Copy the full SHA
    90e16fa View commit details
  7. chore: changeset

    psteinroe committed Mar 13, 2025
    Copy the full SHA
    e6b42e0 View commit details
  8. Merge pull request #560 from juliusmarminge/patch-2

    chore: allow React 19
    psteinroe authored Mar 13, 2025
    Copy the full SHA
    fa8250e View commit details
  9. Merge pull request #549 from psteinroe/renovate/major-happy-dom-monorepo

    chore(deps): update dependency happy-dom to v17
    psteinroe authored Mar 13, 2025
    Copy the full SHA
    5e1056c View commit details
  10. Copy the full SHA
    d27de8f View commit details
Showing with 12,175 additions and 11,169 deletions.
  1. +7 −6 .github/workflows/ci.yml
  2. +4 −1 .github/workflows/update-prs.yml
  3. +4 −1 .gitignore
  4. +2 −0 .nvmrc
  5. +0 −1 README.md
  6. +24 −0 docs/app/[[...mdxPath]]/page.jsx
  7. 0 docs/{pages/_meta.ts → app/_meta.js}
  8. +101 −0 docs/app/layout.jsx
  9. +23 −0 docs/components/linked-tabs.jsx
  10. +50 −0 docs/components/tab-context.jsx
  11. +51 −0 docs/content/configuration.mdx
  12. 0 docs/{pages → content}/index.mdx
  13. 0 docs/{pages → content}/postgrest/_meta.ts
  14. +40 −4 docs/{pages → content}/postgrest/custom-cache-updates.mdx
  15. +13 −11 docs/{pages → content}/postgrest/getting-started.mdx
  16. +17 −8 docs/{pages → content}/postgrest/mutations.mdx
  17. +79 −21 docs/{pages → content}/postgrest/queries.mdx
  18. +31 −2 docs/{pages → content}/postgrest/server.mdx
  19. 0 docs/{pages → content}/postgrest/ssr/_meta.ts
  20. 0 docs/{pages → content}/postgrest/ssr/react-query.mdx
  21. 0 docs/{pages → content}/postgrest/ssr/swr.mdx
  22. +5 −4 docs/{pages → content}/postgrest/subscriptions.mdx
  23. 0 docs/{pages → content}/storage/_meta.ts
  24. +11 −10 docs/{pages → content}/storage/getting-started.mdx
  25. +7 −6 docs/{pages → content}/storage/mutations.mdx
  26. +9 −8 docs/{pages → content}/storage/queries.mdx
  27. +8 −0 docs/mdx-components.jsx
  28. +1 −4 docs/next.config.mjs
  29. +12 −12 docs/package.json
  30. +0 −13 docs/pages/_app.tsx
  31. +0 −29 docs/pages/configuration.mdx
  32. +19 −3 docs/styles/globals.css
  33. +0 −12 docs/tailwind.config.js
  34. +0 −68 docs/theme.config.jsx
  35. +7 −2 docs/tsconfig.json
  36. +21 −0 examples/react-query/components.json
  37. +2 −2 examples/react-query/components/contact/contact-cards.tsx
  38. +1 −1 examples/react-query/components/icons.tsx
  39. +1 −1 examples/react-query/components/typography/code.tsx
  40. +1 −4 examples/react-query/components/typography/p.tsx
  41. +0 −63 examples/react-query/components/ui/accordion.tsx
  42. +0 −156 examples/react-query/components/ui/alert-dialog.tsx
  43. +0 −7 examples/react-query/components/ui/aspect-ratio.tsx
  44. +42 −41 examples/react-query/components/ui/avatar.tsx
  45. +32 −26 examples/react-query/components/ui/button.tsx
  46. +0 −30 examples/react-query/components/ui/checkbox.tsx
  47. +0 −11 examples/react-query/components/ui/collapsible.tsx
  48. +0 −158 examples/react-query/components/ui/command.tsx
  49. +0 −200 examples/react-query/components/ui/context-menu.tsx
  50. +104 −99 examples/react-query/components/ui/dialog.tsx
  51. +222 −170 examples/react-query/components/ui/dropdown-menu.tsx
  52. +0 −29 examples/react-query/components/ui/hover-card.tsx
  53. +15 −18 examples/react-query/components/ui/input.tsx
  54. +15 −16 examples/react-query/components/ui/label.tsx
  55. +0 −236 examples/react-query/components/ui/menubar.tsx
  56. +0 −128 examples/react-query/components/ui/navigation-menu.tsx
  57. +0 −31 examples/react-query/components/ui/popover.tsx
  58. +0 −28 examples/react-query/components/ui/progress.tsx
  59. +0 −44 examples/react-query/components/ui/radio-group.tsx
  60. +0 −48 examples/react-query/components/ui/scroll-area.tsx
  61. +159 −87 examples/react-query/components/ui/select.tsx
  62. +0 −31 examples/react-query/components/ui/separator.tsx
  63. +0 −234 examples/react-query/components/ui/sheet.tsx
  64. +0 −28 examples/react-query/components/ui/slider.tsx
  65. +0 −29 examples/react-query/components/ui/switch.tsx
  66. +0 −55 examples/react-query/components/ui/tabs.tsx
  67. +0 −24 examples/react-query/components/ui/textarea.tsx
  68. +0 −128 examples/react-query/components/ui/toast.tsx
  69. +0 −32 examples/react-query/components/ui/toaster.tsx
  70. +0 −45 examples/react-query/components/ui/toggle.tsx
  71. +0 −31 examples/react-query/components/ui/tooltip.tsx
  72. +0 −188 examples/react-query/hooks/use-toast.ts
  73. +0 −8 examples/react-query/next.config.mjs
  74. +45 −46 examples/react-query/package.json
  75. +1 −1 examples/react-query/pages/_app.tsx
  76. +1 −2 examples/react-query/postcss.config.js
  77. +186 −3 examples/react-query/styles/globals.css
  78. +0 −36 examples/react-query/tailwind.config.js
  79. +539 −29 examples/react-query/types/database.ts
  80. +21 −0 examples/swr/components.json
  81. +2 −2 examples/swr/components/contact/contact-cards.tsx
  82. +1 −1 examples/swr/components/icons.tsx
  83. +1 −1 examples/swr/components/typography/code.tsx
  84. +1 −4 examples/swr/components/typography/p.tsx
  85. +0 −63 examples/swr/components/ui/accordion.tsx
  86. +0 −156 examples/swr/components/ui/alert-dialog.tsx
  87. +0 −7 examples/swr/components/ui/aspect-ratio.tsx
  88. +42 −41 examples/swr/components/ui/avatar.tsx
  89. +32 −26 examples/swr/components/ui/button.tsx
  90. +0 −30 examples/swr/components/ui/checkbox.tsx
  91. +0 −11 examples/swr/components/ui/collapsible.tsx
  92. +0 −158 examples/swr/components/ui/command.tsx
  93. +0 −200 examples/swr/components/ui/context-menu.tsx
  94. +104 −99 examples/swr/components/ui/dialog.tsx
  95. +222 −168 examples/swr/components/ui/dropdown-menu.tsx
  96. +0 −29 examples/swr/components/ui/hover-card.tsx
  97. +15 −18 examples/swr/components/ui/input.tsx
  98. +15 −16 examples/swr/components/ui/label.tsx
  99. +0 −236 examples/swr/components/ui/menubar.tsx
  100. +0 −128 examples/swr/components/ui/navigation-menu.tsx
  101. +0 −31 examples/swr/components/ui/popover.tsx
  102. +0 −28 examples/swr/components/ui/progress.tsx
  103. +0 −44 examples/swr/components/ui/radio-group.tsx
  104. +0 −48 examples/swr/components/ui/scroll-area.tsx
  105. +159 −89 examples/swr/components/ui/select.tsx
  106. +0 −31 examples/swr/components/ui/separator.tsx
  107. +0 −234 examples/swr/components/ui/sheet.tsx
  108. +0 −28 examples/swr/components/ui/slider.tsx
  109. +0 −29 examples/swr/components/ui/switch.tsx
  110. +0 −55 examples/swr/components/ui/tabs.tsx
  111. +0 −24 examples/swr/components/ui/textarea.tsx
  112. +0 −128 examples/swr/components/ui/toast.tsx
  113. +0 −32 examples/swr/components/ui/toaster.tsx
  114. +0 −45 examples/swr/components/ui/toggle.tsx
  115. +0 −31 examples/swr/components/ui/tooltip.tsx
  116. +0 −188 examples/swr/hooks/use-toast.ts
  117. +1 −1 examples/swr/next-env.d.ts
  118. +0 −8 examples/swr/next.config.mjs
  119. +45 −46 examples/swr/package.json
  120. +1 −1 examples/swr/pages/_app.tsx
  121. +13 −12 examples/swr/pages/use-infinite-scroll-query.tsx
  122. +13 −12 examples/swr/pages/use-pagination-query.tsx
  123. +1 −2 examples/swr/postcss.config.js
  124. +186 −3 examples/swr/styles/globals.css
  125. +0 −36 examples/swr/tailwind.config.js
  126. +2 −1 examples/swr/tsconfig.json
  127. +0 −1 examples/swr/tsconfig.tsbuildinfo
  128. +539 −29 examples/swr/types/database.ts
  129. +13 −6 package.json
  130. +48 −0 packages/postgrest-core/CHANGELOG.md
  131. +10 −11 packages/postgrest-core/package.json
  132. +60 −16 packages/postgrest-core/src/cursor-pagination-fetcher.ts
  133. +3 −2 packages/postgrest-core/src/delete-fetcher.ts
  134. +3 −0 packages/postgrest-core/src/index.ts
  135. +1 −1 packages/postgrest-core/src/insert-fetcher.ts
  136. +36 −1 packages/postgrest-core/src/lib/encode-object.ts
  137. +20 −0 packages/postgrest-core/src/lib/get-table-from-url.ts
  138. +12 −13 packages/postgrest-core/src/lib/get-table.ts
  139. +22 −0 packages/postgrest-core/src/lib/like-postgrest-builder.ts
  140. +14 −0 packages/postgrest-core/src/lib/like-query-builder.ts
  141. +23 −0 packages/postgrest-core/src/lib/parse-order-by.ts
  142. +159 −31 packages/postgrest-core/src/offset-pagination-fetcher.ts
  143. +31 −25 packages/postgrest-core/src/postgrest-filter.ts
  144. +13 −22 packages/postgrest-core/src/postgrest-parser.ts
  145. +43 −0 packages/postgrest-core/src/revalidate-tables.ts
  146. +3 −2 packages/postgrest-core/src/update-fetcher.ts
  147. +1 −1 packages/postgrest-core/src/upsert-fetcher.ts
  148. +256 −76 packages/postgrest-core/tests/cursor-pagination-fetcher.spec.ts
  149. +539 −29 packages/postgrest-core/tests/database.types.ts
  150. +1 −1 packages/postgrest-core/tests/delete-fetcher.spec.ts
  151. +1 −1 packages/postgrest-core/tests/delete-item.spec.ts
  152. +1 −1 packages/postgrest-core/tests/index.spec.ts
  153. +4 −0 packages/postgrest-core/tests/lib/get-table.spec.ts
  154. +214 −91 packages/postgrest-core/tests/offset-pagination-fetcher.spec.ts
  155. +61 −0 packages/postgrest-core/tests/postgrest-filter.spec.ts
  156. +11 −0 packages/postgrest-core/tests/postgrest-parser.spec.ts
  157. +161 −0 packages/postgrest-core/tests/revalidate-tables.spec.ts
  158. +1 −1 packages/postgrest-core/tests/update-fetcher.spec.ts
  159. +75 −0 packages/postgrest-react-query/CHANGELOG.md
  160. +12 −12 packages/postgrest-react-query/package.json
  161. +1 −0 packages/postgrest-react-query/src/cache/index.ts
  162. +31 −0 packages/postgrest-react-query/src/cache/use-revalidate-tables.ts
  163. +8 −8 packages/postgrest-react-query/src/mutate/types.ts
  164. +4 −4 packages/postgrest-react-query/src/mutate/use-delete-many-mutation.ts
  165. +4 −4 packages/postgrest-react-query/src/mutate/use-delete-mutation.ts
  166. +4 −4 packages/postgrest-react-query/src/mutate/use-insert-mutation.ts
  167. +33 −16 packages/postgrest-react-query/src/mutate/use-update-mutation.ts
  168. +4 −4 packages/postgrest-react-query/src/mutate/use-upsert-mutation.ts
  169. +2 −2 packages/postgrest-react-query/src/query/use-query.ts
  170. +9 −21 packages/postgrest-react-query/src/subscribe/use-subscription-query.ts
  171. +500 −32 packages/postgrest-react-query/tests/database.types.ts
  172. +4 −2 packages/postgrest-react-query/tests/mutate/use-update-mutation.integration.spec.tsx
  173. +3 −1 packages/postgrest-react-query/tests/subscribe/use-subscription.integration.spec.tsx
  174. +83 −0 packages/postgrest-server/CHANGELOG.md
  175. +10 −23 packages/postgrest-server/package.json
  176. +1 −0 packages/postgrest-server/src/index.ts
  177. +4 −0 packages/postgrest-server/src/key.ts
  178. +28 −6 packages/postgrest-server/src/query-cache.ts
  179. +5 −0 packages/postgrest-server/src/stores/interface.ts
  180. +8 −0 packages/postgrest-server/src/stores/memory.ts
  181. +20 −0 packages/postgrest-server/src/stores/redis.ts
  182. +18 −4 packages/postgrest-server/src/swr-cache.ts
  183. +7 −0 packages/postgrest-server/src/tiered-store.ts
  184. +27 −0 packages/postgrest-server/src/utils.ts
  185. +184 −0 packages/postgrest-server/tests/query-cache.test.ts
  186. +102 −0 packages/postgrest-swr/CHANGELOG.md
  187. +12 −12 packages/postgrest-swr/package.json
  188. +1 −0 packages/postgrest-swr/src/cache/index.ts
  189. +31 −0 packages/postgrest-swr/src/cache/use-revalidate-tables.ts
  190. +110 −45 packages/postgrest-swr/src/lib/create-key-getter.ts
  191. +25 −0 packages/postgrest-swr/src/lib/parse-order-by.ts
  192. +7 −7 packages/postgrest-swr/src/mutate/types.ts
  193. +5 −5 packages/postgrest-swr/src/mutate/use-delete-many-mutation.ts
  194. +5 −5 packages/postgrest-swr/src/mutate/use-delete-mutation.ts
  195. +5 −5 packages/postgrest-swr/src/mutate/use-insert-mutation.ts
  196. +4 −4 packages/postgrest-swr/src/mutate/use-update-mutation.ts
  197. +4 −4 packages/postgrest-swr/src/mutate/use-upsert-mutation.ts
  198. +111 −96 packages/postgrest-swr/src/query/use-cursor-infinite-scroll-query.ts
  199. +48 −27 packages/postgrest-swr/src/query/use-infinite-offset-pagination-query.ts
  200. +38 −20 packages/postgrest-swr/src/query/use-offset-infinite-query.ts
  201. +48 −27 packages/postgrest-swr/src/query/use-offset-infinite-scroll-query.ts
  202. +3 −3 packages/postgrest-swr/src/subscribe/use-subscription-query.ts
  203. +539 −29 packages/postgrest-swr/tests/database.types.ts
  204. +428 −332 packages/postgrest-swr/tests/query/use-cursor-infinite-scroll-query.spec.tsx
  205. +563 −0 packages/postgrest-swr/tests/query/use-infinite-offset-pagination-query.spec.tsx
  206. +0 −136 packages/postgrest-swr/tests/query/use-offset-infinite-query.integration.spec.tsx
  207. +255 −0 packages/postgrest-swr/tests/query/use-offset-infinite-query.spec.tsx
  208. +0 −163 packages/postgrest-swr/tests/query/use-offset-infinite-scroll-query.integration.spec.tsx
  209. +297 −0 packages/postgrest-swr/tests/query/use-offset-infinite-scroll-query.spec.tsx
  210. +0 −281 packages/postgrest-swr/tests/query/use-pagination-query.integration.spec.tsx
  211. +1 −1 packages/postgrest-swr/tests/subscribe/use-subscription-query.integration.spec.tsx
  212. +22 −0 packages/storage-core/CHANGELOG.md
  213. +9 −9 packages/storage-core/package.json
  214. +5 −13 packages/storage-core/src/url-fetcher.ts
  215. +1 −1 packages/storage-core/tests/upload.spec.ts
  216. +1 −1 packages/storage-core/tests/url-fetcher.spec.ts
  217. +34 −0 packages/storage-react-query/CHANGELOG.md
  218. +13 −13 packages/storage-react-query/package.json
  219. +34 −0 packages/storage-swr/CHANGELOG.md
  220. +13 −13 packages/storage-swr/package.json
  221. +3,164 −4,017 pnpm-lock.yaml
  222. +4 −0 renovate.json
  223. +9 −5 supabase/config.toml
  224. +42 −0 supabase/migrations/20240311151148_add_rpcs.sql
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -17,18 +17,19 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3.0.0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.x.x
run_install: false

- name: Set up Node
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Install dependencies
run: pnpm install

- name: Start Supabase
uses: nick-fields/retry@v3
5 changes: 4 additions & 1 deletion .github/workflows/update-prs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Update stale PRs
on: push
on:
push:
branches:
- main

jobs:
update-prs:
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -27,4 +27,7 @@ yarn-error.log*
.turbo

# dist
**/dist/
**/dist/

tsconfig.tsbuildinfo

2 changes: 2 additions & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
22.14.0

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -49,7 +49,6 @@ The cache helpers are split up into reusable libraries.

These are not meant for direct usage.

- `jest-presets`: `jest` presets
- `postgrest-core`: shared logic for [postgrest-js](https://github.com/supabase/postgrest-js)
- `storage-core`: shared logic for [storage-js](https://github.com/supabase/storage-js) operations
- `tsconfig`: `tsconfig.json`s used throughout the monorepo
24 changes: 24 additions & 0 deletions docs/app/[[...mdxPath]]/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { LinkedTabs } from '@/components/linked-tabs';
import { generateStaticParamsFor, importPage } from 'nextra/pages';
import { useMDXComponents as getMDXComponents } from '../../mdx-components';

export const generateStaticParams = generateStaticParamsFor('mdxPath');

export async function generateMetadata(props) {
const params = await props.params;
const { metadata } = await importPage(params.mdxPath);
return metadata;
}

const Wrapper = getMDXComponents({ LinkedTabs }).wrapper;

export default async function Page(props) {
const params = await props.params;
const result = await importPage(params.mdxPath);
const { default: MDXContent, toc, metadata } = result;
return (
<Wrapper toc={toc} metadata={metadata}>
<MDXContent {...props} params={params} />
</Wrapper>
);
}
File renamed without changes.
101 changes: 101 additions & 0 deletions docs/app/layout.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { Footer, Layout, Navbar } from 'nextra-theme-docs';
import { Banner, Head } from 'nextra/components';
import { getPageMap } from 'nextra/page-map';
import 'nextra-theme-docs/style.css';

import { TabProvider } from '../components/tab-context';

export const metadata = {
metadataBase: new URL('https://supabase-cache-helpers.vercel.app'),
title: {
default: 'Supabase Cache Helpers',
template: '%s – Supabase Cache Helpers',
},
description:
'A collection of framework specific Cache utilities for working with Supabase.',
applicationName: 'Supabase Cache Helpers',
generator: 'Next.js',
appleWebApp: {
title: 'Supabase Cache Helpers',
},
other: {
'msapplication-TileImage': '/ms-icon-144x144.png',
'msapplication-TileColor': '#fff',
},
openGraph: {
title: 'Supabase Cache Helpers',
description:
'A collection of framework specific Cache utilities for working with Supabase.',
url: 'https://supabase-cache-helpers.vercel.app',
siteName: 'Supabase Cache Helpers',
images: [
{
url: 'https://supabase-cache-helpers.vercel.app/og-image.png',
width: 1200,
height: 630,
},
],
locale: 'en_US',
type: 'website',
},
twitter: {
card: 'summary_large_image',
title: 'Supabase Cache Helpers',
description:
'A collection of framework specific Cache utilities for working with Supabase.',
images: ['https://supabase-cache-helpers.vercel.app/og-image.png'],
creator: '@psteinroe',
site: 'https://supabase-cache-helpers.vercel.app',
},
};

export const viewport = {
width: 'device-width',
initialScale: 1,
};

export default async function RootLayout({ children }) {
const navbar = <Navbar logo={<span>Supabase Cache Helpers</span>} />;
const pageMap = await getPageMap();
return (
<html lang="en" dir="ltr" suppressHydrationWarning>
<Head faviconGlyph="✦" />
<body>
<Layout
banner={
<Banner storageKey="hiring">
<a
href="https://twitter.com/psteinroe"
target="_blank"
rel="noreferrer"
>
🎉 We are hiring! You want to work on a large-scale Supabase
project? DM me →
</a>
</Banner>
}
navbar={navbar}
footer={
<Footer>
MIT {new Date().getFullYear()}
<a
href="https://supabase-cache-helpers.vercel.app"
target="_blank"
rel="noreferrer"
>
{': '}
Supabase Cache Helpers
</a>
</Footer>
}
editLink="Edit this page on GitHub"
docsRepositoryBase="https://github.com/psteinroe/supabase-cache-helpers/blob/core/docs"
sidebar={{ defaultMenuCollapseLevel: 1 }}
pageMap={pageMap}
>
<TabProvider>{children}</TabProvider>
</Layout>
</body>
</html>
);
}
23 changes: 23 additions & 0 deletions docs/components/linked-tabs.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use client';

import { Tabs } from 'nextra/components';
import React from 'react';
import { useTabContext } from './tab-context';

export const LinkedTabs = ({ id, items, children }) => {
const { selectedTabs, setSelectedTab } = useTabContext();
const selectedTab = selectedTabs[id] || items[0];

const index = items.indexOf(selectedTab);
const selectedIndex = index !== -1 ? index : 0;

return (
<Tabs
items={items}
selectedIndex={selectedIndex}
onChange={(index) => setSelectedTab(id, items[index])}
>
{children}
</Tabs>
);
};
50 changes: 50 additions & 0 deletions docs/components/tab-context.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
'use client';

import { createContext, useContext, useEffect, useState } from 'react';

const TabContext = createContext({
selectedTabs: {},
setSelectedTab: () => {},
});

export const useTabContext = () => useContext(TabContext);

export const TabProvider = ({ children }) => {
const [selectedTabs, setSelectedTabs] = useState({});

useEffect(() => {
if (typeof window !== 'undefined') {
const storedTabs = localStorage.getItem('selectedTabs');
if (storedTabs) {
try {
const parsedTabs = JSON.parse(storedTabs);
setSelectedTabs(parsedTabs);
} catch (error) {
console.error(
'Failed to parse selectedTabs from localStorage',
error,
);
}
}
}
}, []);

useEffect(() => {
if (typeof window !== 'undefined') {
localStorage.setItem('selectedTabs', JSON.stringify(selectedTabs));
}
}, [selectedTabs]);

const setSelectedTab = (id, tab) => {
setSelectedTabs((prev) => ({
...prev,
[id]: tab,
}));
};

return (
<TabContext.Provider value={{ selectedTabs, setSelectedTab }}>
{children}
</TabContext.Provider>
);
};
51 changes: 51 additions & 0 deletions docs/content/configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Callout, Tabs } from 'nextra/components';
import { LinkedTabs } from '@/components/linked-tabs';

# Configuration

Supabase Cache Helpers does a decent job at keeping your data up-to-date. This allows you to deviate from the standard configuration and reduce the number of requests to your backend while keeping your app fresh.

<LinkedTabs items={['SWR', 'React Query']}
id="data-fetcher"
>
<Tabs.Tab>
```tsx
function Page() {
return (
<SWRConfig
value={{
revalidateIfStale: false,
revalidateOnFocus: false,
}}
>
...
</SWRConfig>
)
}
```
</Tabs.Tab>
<Tabs.Tab>
<Callout emoji="🔗">
You can find more details on the [React Query documentation](https://tanstack.com/query/latest/docs/framework/react/quick-start).
</Callout>
```tsx
function Page() {
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
staleTime: Infinity,
gcTime: Infinity,
},
},
});

return (
<QueryClientProvider client={queryClient}>
{/* Your components */}
</QueryClientProvider>
);
}
```
</Tabs.Tab>
</LinkedTabs>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { Callout, Tabs } from 'nextra/components';
import { LinkedTabs } from '@/components/linked-tabs';

# Custom Cache Updates

Sometimes, you will find yourself writing custom cache updates. The library exports two convenience hooks that expose the underlying cache operations.

<Callout emoji="">
These hooks do not do any API requests. They only update the local cache.
</Callout>

## `useDeleteItem`

Delete a postgrest entity from the cache. Note that you have to pass a value for all primary keys in the input.

<Tabs items={['SWR', 'React Query']}>
<LinkedTabs items={['SWR', 'React Query']} id="data-fetcher">
<Tabs.Tab>
```tsx
import { useDeleteItem } from "@supabase-cache-helpers/postgrest-swr";
@@ -43,13 +48,13 @@ Delete a postgrest entity from the cache. Note that you have to pass a value for
```

</Tabs.Tab>
</Tabs>
</LinkedTabs>

## `useUpsertItem`

Upsert a postgrest entity into the cache. Note that you have to pass a value for all primary keys in the input.

<Tabs items={['SWR', 'React Query']}>
<LinkedTabs items={['SWR', 'React Query']} id="data-fetcher">
<Tabs.Tab>
```tsx
import { useUpsertItem } from "@supabase-cache-helpers/postgrest-swr";
@@ -84,4 +89,35 @@ Upsert a postgrest entity into the cache. Note that you have to pass a value for
```

</Tabs.Tab>
</Tabs>
</LinkedTabs>

## `useRevalidateTables`

Revalidate all queries for the given tables.

<LinkedTabs items={['SWR', 'React Query']} id="data-fetcher">
<Tabs.Tab>
```tsx
import { useRevalidateTables } from "@supabase-cache-helpers/postgrest-swr";

function Page() {
const revalidateTables = useRevalidateTables([{ schema: 'public', table: 'contact' }]);

return <div>...</div>;
}
```

</Tabs.Tab>
<Tabs.Tab>
```tsx
import { useRevalidateTables } from "@supabase-cache-helpers/postgrest-react-query";

function Page() {
const revalidateTables = useRevalidateTables([{ schema: 'public', table: 'contact' }]);

return <div>...</div>;
}
```

</Tabs.Tab>
</LinkedTabs>
Loading