Skip to content

Fix Duplicate type definition error during runtime changes in dev environment#90

Merged
rainerdema merged 1 commit intomasterfrom
rainerd/fix-circular-dependency-for-interface-type
Mar 27, 2020
Merged

Fix Duplicate type definition error during runtime changes in dev environment#90
rainerdema merged 1 commit intomasterfrom
rainerd/fix-circular-dependency-for-interface-type

Conversation

@rainerdema
Copy link
Copy Markdown
Contributor

@rainerdema rainerdema commented Mar 20, 2020

Quick Info

Issue Schema updates New type
N/A 👎 👎

With these changes, in the payment_sources configuration param, uses strings to force the correct autoloading of all the classes which are re-converted into constants during the orphan_type assignment and stop the circular dependencies errors in dev environment.

Note

This is a problem that probably occurred only in the development environment:
Because the cache_classes config flag in Solidus cofing/environments/development.rb configuration is usually set to false.

Info

For more information about this problem, consult these issues in graphql-ruby:
rmosolgo/graphql-ruby#2716
rmosolgo/graphql-ruby#935

@rainerdema rainerdema self-assigned this Mar 20, 2020
@rainerdema rainerdema added the bug Something isn't working label Mar 20, 2020
@rainerdema rainerdema force-pushed the rainerd/fix-circular-dependency-for-interface-type branch from 7528aa7 to 1c76e60 Compare March 20, 2020 17:09
@rainerdema rainerdema marked this pull request as ready for review March 20, 2020 17:21
@rainerdema rainerdema force-pushed the rainerd/fix-circular-dependency-for-interface-type branch from 1c76e60 to 76c1e01 Compare March 27, 2020 09:27
AlessioRocco
AlessioRocco previously approved these changes Mar 27, 2020
After a runtime change during the autoloading of the classes
in the development environment (where we usually have the
cache_classes config param set to false), there is a conflict
with the DSL:
At this point, Rails re-loads the files but the code still
retains references to old objects and causes a circular
dependency error in the PaymentSource interface during the
`orphan_type` assignment.

With this change in the `payment_sources` configuration uses
strings to force the correct autoloading of all the classes
which are re-converted into constants during the `orphan_type`
assignment.
@rainerdema rainerdema force-pushed the rainerd/fix-circular-dependency-for-interface-type branch from 76c1e01 to ad6f64c Compare March 27, 2020 09:58
@rainerdema rainerdema merged commit 460ebd1 into master Mar 27, 2020
@rainerdema rainerdema deleted the rainerd/fix-circular-dependency-for-interface-type branch March 27, 2020 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants