Skip to content

RDBC-909 - Returning class instances in client causes issues in Next.js — responses should be plain objects #481

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

Open
wants to merge 1 commit into
base: v7.0
Choose a base branch
from

Conversation

M4xymm
Copy link
Contributor

@M4xymm M4xymm commented Jul 2, 2025

Introduce returnPlainJsObjects convention to optionally convert API results to plain objects. Update query methods to honor this setting by utilizing JsonSerializer.toPlainObject. Include support for environments requiring serializable results, such as Next.js.

Introduce `returnPlainJsObjects` convention to optionally convert API results to plain objects. Update query methods to honor this setting by utilizing `JsonSerializer.toPlainObject`. Include support for environments requiring serializable results, such as Next.js.
@M4xymm M4xymm requested a review from kalczur July 2, 2025 12:49
const array = [...results];

if (this.conventions.returnPlainJsObjects) {
return array.map(item => JsonSerializer.toPlainObject(item))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can item be undefined? if yes we will get SyntaxError.

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