Skip to content

SSR Actions #4375

Open
Open
@PatrickG

Description

@PatrickG

Is your feature request related to a problem? Please describe.
It would be nice if actions could output attributes in SSR context.

Describe the solution you'd like

<script>
  function myAction(node, params) {
    // the normal action stuff for client side
  }
  myAction.SSR = function (params) {
    return {
      'data-some-key': params.someKey,
    };
  }

  export let someKey = 'someValue';
</script>

<div use:myAction={{ someKey }}>
<!-- would render <div data-some-key="someValue"></div> -->

How important is this feature to you?
Somewhat. It's just an idea i had, that could play well with something like svelte-css-vars. Imagine that svelte-css-vars could return { style: '--color: red' } when rendered on the server.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions