Skip to content

Conversation

@fritz-c
Copy link
Contributor

@fritz-c fritz-c commented Feb 7, 2025

Nova's DateTime field (at least the one in Nova v5) uses a static anonymous function to define how to resolve the data to a string. This causes problems in the cloneField (and the dependent duplicateAndHydrate) method in your code, which binds a few of the field callbacks back to the newly cloned field instance. The specific error is:

Cannot bind an instance to a static closure

I initially implemented a fix using ReflectionFunction to detect if a function is static, but settled for a try-catch just in case reflection causes some sort of performance issue at low numbers.

@eslamabdallah74
Copy link

Nice job, this worked with me

@fritz-c
Copy link
Contributor Author

fritz-c commented Feb 11, 2025

@voidgraphics Sorry to bother you, but if you have some time, I'd appreciate if you could look this over. It's essentially a three-line code change (adding a try-catch for an otherwise unavoidable error), accompanied by a thorough new test case where nothing existed before.

@voidgraphics voidgraphics merged commit d48d607 into whitecube:master Feb 11, 2025
@voidgraphics
Copy link
Member

Thanks for the fix @fritz-c!

@fritz-c
Copy link
Contributor Author

fritz-c commented Feb 11, 2025

Thank you very much for reviewing and merging it.

@fritz-c fritz-c mentioned this pull request Feb 18, 2025
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.

3 participants