Skip to content

Conversation

@lostie
Copy link
Contributor

@lostie lostie commented Oct 9, 2025

Context

I've encountered several issues with the query optimizations:

  • the SQL produced for retrieving records with has_one associations is invalid (it's currently trying to select the foreign key from the main record's table) resulting in errors when rendering the view or exporting the view to CSV
  • the SQL produced when the record has composite foreign keys is invalid resulting in errors when rendering the view

I've attempted to fix some of these issues myself, but I ended up realizing that the gem code needs extensive refactoring (and added test coverage) and unfortunately I don't have the necessary time to spend on it.

These query optimizations are breaking changes, and have prevented us from upgrading the gem since the version 9.11.3, so my suggestion is to allows us to use the gem without the query optimizations (which we know it is at least functional).

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

@lostie
Copy link
Contributor Author

lostie commented Oct 9, 2025

FYI @matthv @nicolasalexandre9

@matthv
Copy link
Member

matthv commented Oct 9, 2025

Hello @lostie,

Thanks for the PR! 💪

Quick question: I had previously shared this branch with you: main...fix/polymorphic
Do you still need that polymorphic associations fix to be merged alongside your PR, or does your current PR resolve your issue?
Just to clarify, if we do need to include the polymorphic fix, I'll need to add a custom environment variable to enable it, since some other clients don't need this behavior by default and we want to avoid breaking changes.

Let me know what works best for your use case! 🙏

@matthv
Copy link
Member

matthv commented Oct 13, 2025

Hi @lostie

I have reviewed the code you suggested in detail, and disabling the performance optimisation is not the solution, it should not be a breaking change.
Can we set up a call to discuss it?

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 this pull request may close these issues.

2 participants