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

From Discord: Issue with Request.tagged and Equal.equals for non-primitive parameters #2251

Open
effect-bot opened this issue Mar 5, 2024 · 0 comments · May be fixed by #2258
Open

From Discord: Issue with Request.tagged and Equal.equals for non-primitive parameters #2251

effect-bot opened this issue Mar 5, 2024 · 0 comments · May be fixed by #2258

Comments

@effect-bot
Copy link

Summary

In the above conversation, the user raised an issue with using Request.tagged and Equal.equals for requests that contain non-primitive parameters. It was observed that two requests with equal values are not considered equal according to Equal.equals if they contain non-primitive parameters. This can lead to caching not working for these types of requests.

To address this issue, there are a few best practices to consider:

  1. Use the Data module for internal objects: By using the Data module for non-primitive parameters, you can ensure that they are compared by value rather than by reference. This can help in achieving the desired behavior for caching.

  2. Implement custom Equals for Request objects: Another approach is to manually implement the Equals function for Request objects. This allows you to customize how the objects are compared, taking into account the specific properties that should be considered for equality.

  3. Consider comparing specific properties: In some cases, comparing specific properties, such as an "id" field, may be sufficient for determining equality. This can be a simpler approach, especially for entities where the unique identifier is the most important factor.

Overall, the key takeaway is that when dealing with requests that have non-primitive parameters, it's important to ensure that the equality comparison is implemented correctly to enable caching and other desired behaviors.

Discord thread

https://discord.com/channels/795981131316985866/1214495832246853682

@mikearnaldi mikearnaldi linked a pull request Mar 6, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant