-
Notifications
You must be signed in to change notification settings - Fork 530
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
Graphiql schema does not reload when import_types
uses an alias
#1139
Comments
You're saying the old schema information remains even after you reload the page? |
Yeah, that is correct. I clicked the "Reload Schema" button manually and I can see it hitting the server triggering a compile as well, but the Graphiql interface just shows the old schema. Moreover, when I make changes directly in the schema file, it reloads as expected. |
import_types
uses an alias
@benwilson512 were you able to confirm this? do you need more information from me? |
I have not had time to dig into this, sorry. For now I would simply avoid using the problematic aliases. |
No rush on my side, but just wanted to see if it was reproducible by others. For now, I'm avoiding aliases and will refactor in the future. |
Can confirm it happens to me also. |
Let me add some info. If I use import_types(Project.{
Module1,
Module2
}
and do some changes on type (let's say - renaming a field), these changes would not be seen in test env, so I had to to force recompile in test env every time I did some changes. I just found this issue and changed schema to import_types(Project.Module1)
import_types(Project.Module2) and it solved the problem! |
Confirmed here as well. I have to run a |
I haven't been able to reproduce this issue after upgrading to both Erlang 24.2 and Elixir 1.13. Furthermore, I recently refactored the GraphQL layer that did remove all the aliases from top-level |
Same thing here, the But there is still a problem if you use For example, if we have this on the defmodule MyWeb.API.Users.Schema do
@moduledoc false
use Absinthe.Schema
alias __MODULE__
import_types(Schema.{User}) # Attention to the "{"User"}"
[...]
And defmodule MyWeb.API.Users.Schema.User do
[...]
object :profile do
field(:cool_profile_field, :string, resolve: &Resolver.get_cool_profile_field/3)
end
[...]
If we change that field to something like The result for the {:ok,
%{
errors: [
%{
locations: [%{column: 11, line: 9}],
message:
"Cannot query field \"new_cool_profile_field_\" on type \"Profile\". Did you mean \"coolProfileField\"?"
}
]
}} But if you change to the following (removing the defmodule MyWeb.API.Users.Schema do
@moduledoc false
use Absinthe.Schema
alias __MODULE__
import_types(Schema.User)
[...]
The same problem occurs without the alias: This is very odd. Erlang/OTP 24 [erts-12.2.1] |
Can confirm as well. Took me a long while to figure out that this is related to the |
I couldn't find any documentation or reports, so I apologize if it's a known issue. I just spent an hour debugging this and found out that the schema does not reload if you use
import_types
with an alias.For example, this works:
And this works when recompiling everything, but not on subsequent changes in file:
The text was updated successfully, but these errors were encountered: