Fable.Remoting icon indicating copy to clipboard operation
Fable.Remoting copied to clipboard

GET requests ignored after updating Fable tool to 4.13.0

Open martinbryant opened this issue 1 year ago • 1 comments

Steps to replicate

  • Install SAFE template 5.0.4
  • dotnet new SAFE
  • dotnet tool restore
  • dotnet run
  • Notice that Todos get loaded
  • dotnet tool update Fable (latest is 4.13.0)
  • dotnet run

Expected behaviour

Todos get loaded as before

Actual behaviour

The GET request for the Todos is not fired

Additional info

Works with Fable 4.12.2 POST requests work correctly I have another demo that has multiple GET requests and they are all ignored when firing as a Cmd in Elmish

martinbryant avatar Feb 21 '24 12:02 martinbryant

After doing some quick digging I have located the issue

https://github.com/Zaid-Ajaj/Fable.Remoting/blob/c812705fbd95097191257ff288cdab409029807a/Fable.Remoting.Client/Proxy.fs#L181

Previous behaviour in Fable 4.12.2

inputArguments.[0] on an empty array

would result in undefined serialised to [null]

New behaviour in Fable 4.13.0

inputArguments.[0] on an empty array

result in an exception Index outside the bounds of an Array

Solution

Need some conditional logic around array accessors or tryIndex to prevent the exception

martinbryant avatar Feb 22 '24 11:02 martinbryant