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

fix(ui/QTable): Use correct definition for @request's filter #14345

Merged

Conversation

yusufkandemir
Copy link
Member

What kind of change does this PR introduce?

  • Bugfix
  • Documentation

Does this PR introduce a breaking change?

  • No

Anyone who was misled by the API docs(code examples were correct) and has passed a function instead of a string/object should be warned. Their code will still work since they can send a function filter to requestServerInteraction and expect the function they've sent in onRequest and use it as they wish, but we should advise against this. That is because if they don't pass in a function when calling requestServerInteraction or QTable triggers @request itself, they will receive QTable's filter prop, which can be string/object/undefined.

The PR fulfills these requirements:

  • It's submitted to the dev branch (or v[X] branch)
  • Any necessary documentation has been added or updated in the docs or explained in the PR's description.

Other information:

In the past, I have made some investigations about the type and had a discussion with @rstoenescu:
ab3708d (#11347)

But, yesterday, someone from the community posted this problem. After some investigation and discussion today, I am pretty confident that JSON API and docs examples are wrong. I created this PR to fix&clarify this problem.

@metalsadman also tagging you here since we had a brief discussion about this on our Discord server.

@engineertdog
Copy link

Thanks for the PR, Yusuf. One comment though.

tableRef.value.requestServerInteraction should be the following instead, because tableRef can be undefined.

tableRef.value?.requestServerInteraction

@yusufkandemir
Copy link
Member Author

@engineertdog that's not entirely correct. You wouldn't be able to trigger server interaction and always have an empty table otherwise. tableRef will always be defined in the onMounted hook and anywhere that gets called everything is settled. That's how template refs work. It would only be undefined if you didn't return it(which would be a bigger mistake) or you have v-if that evaluates to false on the q-table. So, in this example, it will always be undefined, so it's correct.

@rstoenescu rstoenescu merged commit f9983f5 into quasarframework:dev Sep 14, 2022
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.

None yet

3 participants