riot / ssr

Riot.js node Server Side Rendering
MIT License
32 stars 8 forks source link

input value will disappear by calling fragments #35

Closed rzfang closed 2 years ago

rzfang commented 2 years ago

Environment

Linux Mint 20.3 Cinnamon node@14.19.1 npm@6.14.16 @riotjs/ssr@8.0.0

Steps to reproduce the problem.

Can not find any platform which can run ssr, so I paste code here.

file - test.riot.js

export default {
  css: null,
  exports: null,

  template: (
    template,
    expressionTypes,
    bindingTypes,
    getComponent
  ) => template(
    '<input type="button" value="GJ"/>',
    []
  ),

  name: 'test'
};

file - test.js

import ssr from '@riotjs/ssr';
import test from './test.riot.js';

const { html: HTML, css: CSS } = ssr.fragments('test', test, {});

console.log(HTML);

test.js output - the value becomes empty.

<test><input type="button" value=""></test>
rzfang commented 2 years ago

It looks like that input[type=radio] has the same issue: <input type='radio' value='test'/> becomes <input type='radio' value=''/>

BUT, this is workable: <input type='radio' value={'test'}/>

GianlucaGuarini commented 2 years ago

I will need to investigate it. For now you can simply use <input value={'your-value'}/>. That should work.

GianlucaGuarini commented 2 years ago

Fixed in @riotjs/ssr@8.0.1 thank you for reporting it

rzfang commented 2 years ago

Verified, the issue gone. Thanks.