TanStack / router

🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering.
https://tanstack.com/router
MIT License
8.26k stars 656 forks source link

docs(start): explicitly set POST method `updateCount` server function examples #2806

Closed Balastrong closed 2 days ago

Balastrong commented 2 days ago

Since the default method is GET I think it's correct to explicitly set these examples to POST

nx-cloud[bot] commented 2 days ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit cca1b0c5f3e856c0dee93234bc4f4cc084edb3a5. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets - [`nx affected --targets=test:eslint,test:unit,test:e2e,test:types,test:build,build --parallel=3`](https://cloud.nx.app/runs/eFqLpprt5I?utm_source=pull-request&utm_medium=comment) - [`nx run-many --target=build --exclude=examples/** --exclude=e2e/**`](https://cloud.nx.app/runs/1EjowMW0Pn?utm_source=pull-request&utm_medium=comment)

Sent with 💌 from NxCloud.

pkg-pr-new[bot] commented 2 days ago

Open in Stackblitz

More templates

- [tanstack-router-react-example-authenticated-routes](https://pkg.pr.new/template/44d267fd-1794-42fa-8ec5-16f12376d93c) - [tanstack-router-react-example-basic](https://pkg.pr.new/template/8cfeb337-cc03-4a4f-aee6-45fde1c577c3) - [tanstack-router-react-example-basic-default-search-params](https://pkg.pr.new/template/c78e9d35-119f-4458-a1b1-33bec7c7d746) - [tanstack-router-react-example-basic-file-based](https://pkg.pr.new/template/d87d23bf-7ff5-4e37-bf71-4bad38c5d117) - [tanstack-router-react-example-basic-file-based-codesplitting](https://pkg.pr.new/template/7da7f475-4865-4c9f-ac17-70fcee97c57e) - [tanstack-router-react-example-react-query](https://pkg.pr.new/template/5ee7084c-9b1f-46e1-817f-20acae5ca8d4) - [tanstack-router-react-example-basic-react-query-file-based](https://pkg.pr.new/template/5f5a90c8-76bc-4e9c-92c5-b86bf81c9dce) - [tanstack-router-react-example-basic-ssr-streaming-file-based](https://pkg.pr.new/template/5ec11420-5a9a-46b5-a2e1-0203a659a8fa) - [tanstack-router-react-example-basic-ssr-file-based](https://pkg.pr.new/template/e3db0ead-bbd1-4591-a99c-4a1eb5140f41) - [tanstack-router-react-example-basic-virtual-file-based](https://pkg.pr.new/template/42634365-bd54-47f6-87ab-0547c555180e) - [tanstack-router-react-example-basic-virtual-inside-file-based](https://pkg.pr.new/template/83e103fb-eccd-4574-bc7f-b597af0d30c8) - [tanstack-router-react-example-deferred-data](https://pkg.pr.new/template/9b55e97d-372f-485b-89ed-c8d7ea8f558c) - [tanstack-router-react-example-kitchen-sink](https://pkg.pr.new/template/99dc83c7-e15b-48e2-b4cb-7e3e29ade3eb) - [tanstack-router-react-example-kitchen-sink-file-based](https://pkg.pr.new/template/fa327f98-cd1e-488b-bd31-42bce2c91b04) - [tanstack-router-react-example-kitchen-sink-react-query](https://pkg.pr.new/template/caa0831a-7eb1-4ae5-b3dd-eba6426efa8b) - [tanstack-router-react-example-kitchen-sink-react-query-file-based](https://pkg.pr.new/template/2198979e-8657-4ac8-8492-444a20814b3e) - [tanstack-router-react-example-large-file-based](https://pkg.pr.new/template/7bbc6db0-5aa9-464c-a177-03324f1d57f8) - [tanstack-router-react-example-location-masking](https://pkg.pr.new/template/9e5c6063-8748-4418-a7d9-6f82a7f9ef9d) - [tanstack-router-react-example-navigation-blocking](https://pkg.pr.new/template/f437a502-aaf4-4956-96d4-2a3a59ff8846) - [tanstack-router-react-example-quickstart](https://pkg.pr.new/template/b755af19-acd5-4443-ae51-60277ea5ee26) - [tanstack-router-react-example-quickstart-file-based](https://pkg.pr.new/template/c765ae2d-03a9-426c-8b02-4674531d7be6) - [tanstack-router-react-example-quickstart-esbuild-file-based](https://pkg.pr.new/template/2f00d8eb-c3f3-4c97-bd54-47846d387a8c) - [tanstack-router-react-example-quickstart-rspack-file-based](https://pkg.pr.new/template/fd12683d-1ab1-40ca-9eb0-00dde302f207) - [tanstack-router-react-example-quickstart-webpack-file-based](https://pkg.pr.new/template/1c5cc804-51dc-4859-acd7-bc36f91a8038) - [router-monorepo-react-query](https://pkg.pr.new/template/76bbc7ce-9558-4735-b3e0-7028e03a39c9) - [router-mono-simple](https://pkg.pr.new/template/056f132c-fb18-4b3b-805d-64931c9a0597) - [tanstack-router-react-example-scroll-restoration](https://pkg.pr.new/template/3ca0d653-957a-4d8e-8660-18c8ea032db5) - [tanstack-search-validator-adapters](https://pkg.pr.new/template/3043a975-80fa-48cf-ab75-4483109f9eeb) - [tanstack-start-example-basic](https://pkg.pr.new/template/d5e689eb-d441-467c-b4b4-290073947fcc) - [tanstack-start-example-basic-auth](https://pkg.pr.new/template/334e838d-8441-4a92-abb1-ff30fbe939ac) - [tanstack-start-example-basic-react-query](https://pkg.pr.new/template/a9f7a56d-03a8-41eb-8f3e-46ec22785f5b) - [tanstack-start-example-basic-rsc](https://pkg.pr.new/template/2c659c98-2cd0-4489-b6d1-4479aef5db20) - [tanstack-start-example-clerk-basic](https://pkg.pr.new/template/612625d8-ddd3-49eb-9d45-49f73d0d6ff0) - [tanstack-start-example-convex-trellaux](https://pkg.pr.new/template/079df4ac-b195-42c5-9ab0-82b920f3af7f) - [tanstack-start-example-counter](https://pkg.pr.new/template/30028bd3-45ed-4682-91b6-05d61e61bc5d) - [tanstack-start-example-supabase-basic](https://pkg.pr.new/template/b3f47943-48e5-4090-a3e0-351b7ff77d1c) - [tanstack-start-example-trellaux](https://pkg.pr.new/template/e7f0def5-3569-452b-927e-10bfa690a118) - [tanstack-router-react-example-with-framer-motion](https://pkg.pr.new/template/bf3496aa-f91e-4f57-a9e5-7f61ec36dcae) - [tanstack-router-react-example-with-trpc](https://pkg.pr.new/template/c847851b-99b4-4258-af28-c6ef99909046) - [tanstack-router-react-example-with-trpc-react-query](https://pkg.pr.new/template/78c03446-04f7-459e-ad77-d98e989ba8c4)

@tanstack/arktype-adapter

``` pnpm add https://pkg.pr.new/@tanstack/arktype-adapter@2806 ```

@tanstack/create-router

``` pnpm add https://pkg.pr.new/@tanstack/create-router@2806 ```

@tanstack/eslint-plugin-router

``` pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-router@2806 ```

@tanstack/history

``` pnpm add https://pkg.pr.new/@tanstack/history@2806 ```

@tanstack/react-cross-context

``` pnpm add https://pkg.pr.new/@tanstack/react-cross-context@2806 ```

@tanstack/react-router

``` pnpm add https://pkg.pr.new/@tanstack/react-router@2806 ```

@tanstack/react-router-with-query

``` pnpm add https://pkg.pr.new/@tanstack/react-router-with-query@2806 ```

@tanstack/router-cli

``` pnpm add https://pkg.pr.new/@tanstack/router-cli@2806 ```

@tanstack/router-devtools

``` pnpm add https://pkg.pr.new/@tanstack/router-devtools@2806 ```

@tanstack/router-generator

``` pnpm add https://pkg.pr.new/@tanstack/router-generator@2806 ```

@tanstack/router-vite-plugin

``` pnpm add https://pkg.pr.new/@tanstack/router-vite-plugin@2806 ```

@tanstack/router-plugin

``` pnpm add https://pkg.pr.new/@tanstack/router-plugin@2806 ```

@tanstack/start

``` pnpm add https://pkg.pr.new/@tanstack/start@2806 ```

@tanstack/start-vite-plugin

``` pnpm add https://pkg.pr.new/@tanstack/start-vite-plugin@2806 ```

@tanstack/valibot-adapter

``` pnpm add https://pkg.pr.new/@tanstack/valibot-adapter@2806 ```

@tanstack/virtual-file-routes

``` pnpm add https://pkg.pr.new/@tanstack/virtual-file-routes@2806 ```

@tanstack/zod-adapter

``` pnpm add https://pkg.pr.new/@tanstack/zod-adapter@2806 ```

commit: cca1b0c

Balastrong commented 2 days ago

For sure we have to explicitly set POST otherwise it's gonna default to GET which feels wrong in the mutations, I'd keep that as is in the PR.

Speaking of the explicit GET we can remove it if we think it's redundant and we want to remove an extra step but being explicit on the method doesn't seem like a bad idea to me.