-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix: No joinBy dimension found in cube #1574
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
...joinBy: string -> string[]
68ab3b2
to
1177fa3
Compare
In the past, I think I had this error and solve it by completely remounting a component, using In the page linked here, Thomas shows a copy of the chart, so the flow would not involve AddDatasetDialog here right ? |
Concerning the variables order, I do not think this is the problem as urql internally normalize the variables through the operation document. When reading a query from the cache, there's a call to normalize variables. When normalizing, the client re-orders the keys according to what's defined in the Below, part of the
[
{
"kind": "OperationDefinition",
"operation": "query",
"name": {
"kind": "Name",
"value": "DataCubeObservations"
},
"variableDefinitions": [
{
"kind": "VariableDefinition",
"variable": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "sourceType"
}
},
"type": {
"kind": "NonNullType",
"type": {
"kind": "NamedType",
"name": {
"kind": "Name",
"value": "String"
}
}
},
"directives": []
},
{
"kind": "VariableDefinition",
"variable": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "sourceUrl"
}
},
"type": {
"kind": "NonNullType",
"type": {
"kind": "NamedType",
"name": {
"kind": "Name",
"value": "String"
}
}
}, |
Nice, I didn't know about the normalization :) I think this problem only appears when we transition from old state to new state, and for a brief moment have a mismatch, I am not sure if it would happen for already merged cubes 🤔 The problem that Thomas mentioned is solved by the new migration (this chart is using string as I tried to add such key to |
1177fa3
to
17721f9
Compare
One of the original problems of this PR was solved by #1577 |
Fixes #1475
I am not 100% happy with the solution, but after spending more than 2h researching what might be the underlying problem, I didn't manage to solve it in another way.
I think there is some issue with caching behavior, as
ChartDataWrapper
that loads the data does not immediately switch to a new query, even though the variables were updated.The current flow is:
AddDatasetDialog
fetches the new data viaexecuteDataCubesComponentsQuery
, which should populate the client-side cache,DATASET_ADD
action that updates the configurator state, which then propagates the changes downstream,ChartDataWrapper
receives updated data, but for some reason does not immediately trigger new query, which leads to joinBy dimension not found error (asChartConfig
has already been updated).I discovered that we had a mismatch with variables keys order when it comes to
ChartDataWrapper
andAddDatasetDialog
(locale should not be the first, but third one) that would be one candidate for not hitting the cache.I also tried with setting
keepPreviousData
to false, but none of these approaches worked; that's why I introduced another, non-optional fix to prevent crashing the application.@ptbrowne do you have an idea on how to fix this in other way, maybe I missed something?
PS. I also tried to change caching key behavior in hook utils file to only rely on
options.variables
and notoptions
, but I don't think this is the reason, as this only caches query in theuseQuery
hook, not in theurql
client (but anyway, this also didn't work).