Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remix single fetch: returning submission.reply() with action results in type never. #628

Open
coji opened this issue May 4, 2024 · 2 comments

Comments

@coji
Copy link
Contributor

coji commented May 4, 2024

Describe the bug and the expected behavior

remix-run/remix#9374

Conform version

v1.1.3

Steps to Reproduce the Bug or Issue

https://stackblitz.com/~/github.com/coji/conform-on-remix-single-fetch

What browsers are you seeing the problem on?

Chrome

Screenshots or Videos

CleanShot 2024-05-04 at 23 12 53@2x

Additional context

I have also raised it as a remix issue. I think it may be a type definition problem on the remix side.
remix-run/remix#9374

@coji coji changed the title Remix single fetch: returning conform.reply() with action results in type never. Remix single fetch: returning submission.reply() with action results in type never. May 4, 2024
@coji
Copy link
Contributor Author

coji commented May 11, 2024

I've received feedback from several users about an issue with SubmissionResult's prop Result<string, unknown>. The unknown type is problematic because it introduces uncertainty about serializability by turbo-stream, which could lead to runtime errors.
remix-run/remix#9374 (comment)

To address this, it's recommended to replace unknown with a more specific type that turbo-stream can reliably serialize. This will improve type safety and prevent potential issues.
However, I'm not quite sure how to best implement this change while maintaining compatibility and avoiding any unintended consequences. I would greatly appreciate your guidance on the most appropriate way to refactor the code to resolve this problem.

@coji
Copy link
Contributor Author

coji commented May 12, 2024

I've updated to remix v2.9.2 and the type error is gone,
However, the newly introduced defineAction / defineLoader still seems to cause type errors due to Result<string, unknown>.

remix-run/remix#9374 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant