Skip to content
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

Add support for nested fields filtering & Fix bug with null/'' dates #47

Merged
merged 18 commits into from
May 25, 2021

Conversation

pankgeorg
Copy link
Contributor

With a different approach than remiremi, but inspired from his PR!

Feel free to close if you go another way!

Remi Koenig and others added 5 commits January 27, 2021 17:07
@pankgeorg pankgeorg marked this pull request as draft February 20, 2021 10:55
@wiezmankimchi
Copy link

I tested and found this to be working as expected. There is only one change to the code need to be added to take care of an error: "Element does not exist" on the screen, or Error: expected a 32-bit integer for type "Int", but found a string. on the console.
This happens when the ID field in the db is Int while the buildGetListVariables build it with values as String. The change should be as follows:


const buildCreateVariables = (resource, aorFetchType, params, queryType) => {
  return params.data;
};

**// added to change cast for ID field from STRING to INT
const castIdType = (params, resource) => {
  const id = params.id
  const target = params.target

  if (!id) return

  const key = target ?? "id"
  const typedParam = resource.type.fields.find(f => key === f.name)
  if (!typedParam) return

  if (getFinalType(typedParam.type).name === "Int") {
    params[key] = parseInt(params[key])
  }
}**

  resource,
  aorFetchType,
  params,
  queryType
) => {
  **castIdType(params, resource)**
  switch (aorFetchType) {

This should change the cast of the ID field to the correct type.

@pankgeorg
Copy link
Contributor Author

are you passing variables as 1234 or 1234?

@pankgeorg
Copy link
Contributor Author

Adding a fix for this: marmelab/react-admin#6199

@pankgeorg pankgeorg changed the title Add support for nested fields filtering Add support for nested fields filtering & Fix bug with null/'' dates May 24, 2021
@pankgeorg pankgeorg marked this pull request as ready for review May 24, 2021 12:36
@praveenweb praveenweb merged commit 2ff0c86 into hasura:master May 25, 2021
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