Commit graph

23 commits

Author SHA1 Message Date
Greg Johnston
33590d487b
chore: clean up warnings causing CI issues (#2119) 2023-12-18 08:15:46 -05:00
Trey Lowerison
ed61ea9dd2
feat: add support for placing attributes on server functions (#2093)
* fix: add support for placing attributes on server functions

Adding instrumentation to server functions is not straightforward (requires calling out to another ssr-only function which is instrumented). This commit adds all attributes on the server function to both the generated front end and back end functions. If those attributes are only desirable on the backend say, a user can always wrap their attribute in `#[cfg_attr(feature = "ssr", ..)]`.

* nit: formatting in example cargo
2023-12-01 15:36:52 -05:00
Gabriel de Perthuis
2c8f46466b
feat: support default values for annotated server_fn arguments with #[server(default)] (#1762)
This allows form submission with checkbox inputs to work.
For example:

    let doit = create_server_action::<DoItSFn>();
    <ActionForm action=doit>
      <input type="checkbox" name="is_good" value="true"/>
      <input type="submit"/>
    </ActionForm>

    #[server(DoItSFn, "/api")]
    pub async fn doit(#[server(default)] is_good: bool) -> Result<(), ServerFnError> {}

If is_good is absent in the request to the server API,
`Default::default()` is used instead.
2023-09-20 20:43:20 -04:00
Fangdun Tsai
e706a69139
chore(server_fn_macro): improve docs (#1733) 2023-09-18 20:48:47 -04:00
blorbb
c87212f2d7
chore: remove (most) syn 1 dependencies (#1670) 2023-09-08 14:46:38 -04:00
Mark Catley
533fccd1d3
fix: nightly warning in server macro for lifetime (#1580)
On the latest lifetime we're getting the following warning in the server
macro:
 warning: `&` without an explicit lifetime name cannot be used here
   --> src/login.rs:19:1
    |
 19 | #[server(Login, "/api")]
    | ^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
    = note: this warning originates in the attribute macro `server` (in Nightly builds, run with -Z macro-backtrace for more info)
2023-08-24 06:30:13 -04:00
Greg Johnston
5e26e84d77
feat: allow feature-name flexibility when using server functions (#1427) 2023-07-25 06:07:52 -04:00
Joseph Cruz
3481a6ee53
build: run tasks from workpace or member directory (#1339) 2023-07-13 16:46:51 -04:00
Greg Johnston
e821efca07
chore: new cargo fmt (#1266) 2023-07-02 17:01:39 -04:00
Greg Johnston
ee7dbafc85
change: migrate to nightly and csr features rather than stable and default-features = false (#1227) 2023-06-26 21:12:14 -04:00
Greg Johnston
bb10b32200
feat: register server functions automatically (#1154) 2023-06-11 09:09:21 -04:00
Greg Johnston
abf90358fa
fix: pass through docs for server functions (#1164) 2023-06-09 16:07:08 -04:00
Vladimir Motylenko
5a71ca797a
feat: RSX parser with recovery after errors, and unquoted text (#1054)
* Feat: Upgrade to new local version of syn-rsx

* chore: Make macro more IDE friendly

1. Add quotation to RawText node.
2. Replace vec! macro with [].to_vec().
Cons:
1. Temporary remove allow(unused_braces) from expressions, to allow completion after dot in rust-analyzer.

* chore: Change dependency from syn-rsx to rstml

* chore: Fix value_to_string usage, pr comments, and fmt.
2023-05-21 06:45:53 -04:00
Ben Wishovich
dd41c0586c
feat: allow specifying exact server function paths (#1069) 2023-05-19 16:47:28 -04:00
Matt Crane
6753ba21c4
fix: allow server functions to work with non-Cargo build systems with SERVER_FN_OVERRIDE_KEY env var (#878) 2023-04-17 08:46:32 -04:00
Greg Johnston
1187a506dd
fix: server functions with url as argument name (closes issue #823) (#825) 2023-04-07 09:28:31 -04:00
Ben Wishovich
8b57ba7aa8
feat: add the ability for server fns to be submitted via GET requests (#789) 2023-04-05 06:47:17 -04:00
Mark Catley
db9b7db53d
fix: unused warning on cx in server functions (#794)
When running cargo clippy on server functions that use `cx: Scope` it
has an unused variable error.

It appears that the logic for adding an `#[allow(unused)]` notation is
inverted.
2023-04-03 21:07:30 -04:00
ealmloff
a9e6590b5e
fix: server functions with non-copy server contexts (#785) 2023-04-03 07:17:22 -04:00
Igor Shevchenko
98a9ec8335
chore(docs): fix a few typos (#756) 2023-03-27 20:06:34 -04:00
Greg Johnston
38daaf3b72
chore: apply cargo machete systematically (#671) 2023-03-13 10:16:20 -04:00
Greg Johnston
b55e9a9e64
v0.2.3: fix broken stable support (#670) 2023-03-13 07:25:08 -04:00
ealmloff
0c261c0fb0
feat: make server functions framework agnostic (#596) 2023-03-01 20:56:30 -05:00