Commit Graph
118 Commits
Author SHA1 Message Date
Christian Svensson b4c3ff8e98 feat: add flag to FreshContext for partial requests (#2993)
Addresses a gap between [Fresh
v1](https://github.com/denoland/fresh/blob/1.x/src/server/types.ts#L192)
and Fresh v2, by adding `ctx.isPartial` to `FreshContext`.

The same route (e.g. `GET /api/autocomplete`) can be called from both an
Island or a Partial. Returning JSON or HTML depending on the destination
of the code.

Or is the intent that endpoints returning partials and data should be
separated, and this pattern is not to be encouraged in Fresh v2? My use
case in Fresh v1 was an `/routes/api/cart.tsx`, which can either just
toggle a product from the cart (via cookie), but also update UI elements
(e.g. cart icon) based on if called from partial or not.


![image](https://github.com/user-attachments/assets/a1cbcfb1-2446-4d6d-bce5-4c3d6acf9bfd)
2025-05-26 14:15:36 +02:00
Asher Gomez 20162f6896 chore: use lint tags (#2952) 2025-05-15 09:34:46 +02:00
Marvin Hagemeister d2da471d67 fix(partial): form dialog method not supported (#2927)
The `<form>` method value `dialog` does no network request, so we should
ignore it for partials.

Fixes https://github.com/denoland/fresh/issues/2885
2025-05-12 21:19:19 +02:00
Marvin Hagemeister 09705b9b7f fix: bigint key values erroring (#2923)
Fixes https://github.com/denoland/fresh/issues/2802
2025-05-12 19:49:13 +02:00
Asher Gomez e0ca9423d9 BREAKING(core): remove Mode type (#2884)
It doesn't seem like it deserves to be it's own type. It can just be an
interface property.
2025-05-05 08:40:34 +02:00
Luca Casonato 6b685dde9f fix: serve internal JS from path containing build ID (#2753)
Previously imported chunks were not cached at all. They are now cached
properly with immutable cache headers.
2024-11-08 11:44:15 +01:00
Luca Casonato 8ced083267 fix: serialization of signals containing null and undefined values (#2744) 2024-10-31 11:22:03 +01:00
Marvin Hagemeister a596a04258 fix: SVG in links breaking partials (#2681)
Fixes https://github.com/denoland/fresh/issues/2239
2024-10-04 08:08:18 +02:00
Marvin Hagemeister 75b5854810 fix: nested children slots erroring (#2674)
Fixes https://github.com/denoland/fresh/issues/2624
2024-10-04 05:05:27 +02:00
Marvin HagemeisterandLuca Casonato de8f1b0c59 feat: update for Deno 2 (#2655)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-09-30 18:30:30 +02:00
Reed von Redwitz 8413666786 fix: support numeric keys when rendering (#2584)
I'm trying to migrate one of my projects which publishes a plugin, and
this was blocking me.

Looks like key is typed as `export type Key = string | number | any;`,
so we might need to make more changes here in the future.
2024-07-07 19:09:11 +02:00
Marvin Hagemeister 6be6435467 fix: missing dom root frag polyfill after preact update (#2569) 2024-07-03 10:39:33 +02:00
Marvin Hagemeister 79a262b344 fix: GET partial form submit ignoring multiple checkbox values (#2568)
Fixes https://github.com/denoland/fresh/issues/2567
2024-07-02 22:24:48 +02:00
Marvin Hagemeister 0f6b4f624f chore: remove debug trace logs (#2545) 2024-06-25 10:08:48 +02:00
Marvin Hagemeister 003f2bbb5f fix: incorrect partial url on backwards navigation (#2510) 2024-06-08 09:01:12 +02:00
Adam Gregory 8c5e2b00c9 fix: Include submitter data in partial form data (#2307)
Fixes #2306
2024-06-06 19:02:49 +02:00
Marvin Hagemeister 2b88f4bf56 fix: falsy f-* attributes not preserved inside island (#2498)
Fixes https://github.com/denoland/fresh/issues/2359
2024-06-05 10:06:53 +02:00
Marvin Hagemeister fba3f2b845 fix: partial form redirect not working (#2497)
Fixes https://github.com/denoland/fresh/issues/2404
2024-06-05 09:42:27 +02:00
Marvin Hagemeister d613c6a6ba fix: islands not working with basePath (#2496) 2024-06-05 09:02:27 +02:00
Marvin Hagemeister f8b60ddd15 fix: wrong url after partial form submission (#2495)
Fixes https://github.com/denoland/fresh/issues/2409
2024-06-05 08:30:28 +02:00
Marvin Hagemeister e007597ff3 feat: remove MODE global (#2483) 2024-06-03 16:54:37 +02:00
Marvin Hagemeister 88c3671a09 fix: error handling in fs routes (#2474)
Ran into an issue where we weren't responding with the correct status
code and passed response headers. This was a bit of a rabbit hole and it
was caused by us wrapping to more error handling middlewares than
necessary.
2024-05-31 14:27:36 +02:00
Luca Casonato 8d85945da6 fix: remove Data from FreshContext (#2473)
This is now only on `PageProps`.
2024-05-31 13:50:28 +02:00
Marvin Hagemeister f9545c3d63 fix: don't show error overlay on HttpError < 500 (#2462) 2024-05-24 23:46:21 +02:00
Marvin Hagemeister 77dc77826e fix: only load error overlay in development (#2460) 2024-05-24 20:29:59 +02:00
Marvin Hagemeister 287929e4d2 major: import Fresh 2.0 code (#2449)
🎉
2024-05-24 09:40:08 +02:00
Reed von Redwitz a83765efaa fix: no-window lint error (#2272)
Latest PR runs are failing with linting errors, e.g.
https://github.com/denoland/fresh/actions/runs/7625625084/job/20770308634?pr=2266

Maybe this shouldn't be happening like this right now, but we'll still
need to clean these up eventually.
2024-01-23 21:51:38 +01:00
Marvin Hagemeister 9f81806c6e fix: __FRSH_STATE potentially being overwritten by user code (#2256)
As outlined in https://github.com/denoland/fresh/issues/2254 it was
possible to overwrite the script tag that is used by Fresh to pass
island props from the server to the client. This could be done by
injecting raw HTML via `dangerouslySetInnerHTML` and simply using the
same id that Fresh was using.

With this PR we generate a unique id per render that cannot be guessed
anymore. It's composed of `__FRSH_STATE_<uuid>`
2024-01-15 19:41:12 +01:00
Luca Casonato 8583394481 fix: prototype pollution in deserializer (#2255)
This is not exploitable in practice unless a user maliciously crafts
serialized values in __FRSH_STATE, because `serializer()` never outputs
serialized representation that would be vulnerable to prototype
pollution. But hey, defense in depth.
2024-01-15 18:03:59 +00:00
Igor Brasileiro e7bf6aca62 fix: Prevent update doc title from partial if not present (#2244)
fixes #2243
2024-01-12 18:47:40 +01:00
Marvin Hagemeister d2e9ee99a2 fix: browser url not updated with form partials (#2236)
Fixes https://github.com/denoland/fresh/issues/2173
2024-01-10 15:36:30 +01:00
Marvin Hagemeister 3410470d5e fix: ensure previous ws connection is closed in dev (#2154) 2023-12-07 11:17:23 +01:00
Marvin Hagemeister 325850719a feat: reduce number of island bundles (#2082) 2023-11-28 17:23:27 +01:00
Marvin Hagemeister 9ee6ab72e0 fix: show original error page in dev (#2074) 2023-11-28 11:58:50 +01:00
Marvin Hagemeister a56ea283c8 fix: Partials not working on error pages (#2072) 2023-11-27 16:56:46 +01:00
Marvin Hagemeister 27adeb7b14 fix: redirects with partials (#2053) 2023-11-21 11:35:08 +01:00
Marvin Hagemeister 4fa0a637f0 chore: refactor dev client (#2002) 2023-11-06 10:31:51 +01:00
Reed von Redwitz ded71a934f docs: add jsdoc for IS_BROWSER (#1991) 2023-10-31 18:49:18 +01:00
Tiago Gimenes 84ff79beca feat: Nested partials support (#1955) 2023-10-18 18:26:46 +02:00
Marvin Hagemeister b984da9113 fix: browser not reloaded when no island present (#1956) 2023-10-18 11:16:51 +02:00
Marvin Hagemeister bfabb2ec98 feat: add support for partials on forms (#1930) 2023-10-16 22:45:11 +02:00
Marvin Hagemeister bbedea5377 fix: dev client script being loaded twice (#1944) 2023-10-16 09:47:56 +02:00
Marvin Hagemeister 86a96eeee4 fix: switch to websockets for development server (#1943) 2023-10-16 07:44:27 +02:00
Marvin Hagemeister 0192316785 fix: unable to opt out of nested client nav (#1940) 2023-10-15 08:41:13 +02:00
Marvin Hagemeister 7d954584a6 fix: island marker parsed as key marker (#1922) 2023-10-12 13:40:23 +02:00
Marvin Hagemeister 78b0b05fc3 fix: make active + ancestor links accessible (#1915) 2023-10-11 17:29:07 +02:00
Marvin Hagemeister a1f0d4a5bd fix: don't scroll on fragment links in partials (#1906) 2023-10-11 10:30:31 +02:00
Tiago Gimenes 15f869715c fix: Partial state deserialization on simple islands (#1873) 2023-10-07 23:08:04 +02:00
Tiago Gimenes 2df5921b59 feat: Use href instead of origin on Partial (#1870) 2023-10-07 23:07:42 +02:00
Marvin Hagemeister e9717ed911 fix: meta charSet -> charset (#1875) 2023-10-06 15:59:13 +02:00