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

feat(KTable): add types [KHCP-6973] #1457

Merged
merged 2 commits into from
Aug 1, 2023

Conversation

DariaYeremina
Copy link
Contributor

@DariaYeremina DariaYeremina commented Jun 13, 2023

Summary

https://konghq.atlassian.net/browse/KHCP-6973
Add types for KTable

PR Checklist

  • Does not introduce dependencies
  • Functional: all changes do not break existing APIs and if so, bump major version.
  • Tests pass: check the output of yarn test
  • Naming: the files and the method and prop variables use the same naming conventions as other Kongponents
  • Framework style: abides by the essential rules in Vue's style guide
  • Cleanliness: does not have formatting issues, unused code (e.g., console.logs, debugger), or leftover comments
  • Docs: includes a technically accurate README, uses JSDOC where appropriate

@DariaYeremina DariaYeremina self-assigned this Jun 13, 2023
@DariaYeremina DariaYeremina requested a review from a team as a code owner June 13, 2023 18:18
@netlify
Copy link

netlify bot commented Jun 13, 2023

Deploy Preview for kongponents ready!

Name Link
🔨 Latest commit 2251b10
🔍 Latest deploy log https://app.netlify.com/sites/kongponents/deploys/64c907db4b99430008c8a9e9
😎 Deploy Preview https://deploy-preview-1457--kongponents.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@kaiarrowood kaiarrowood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to make the prop types so tight, can we loosen them to avoid typecasting in the host app?

We've had to back out changes like this already: #1299

SortColumnOrder,
TableOptions,
TableSortOrder,
TableSortPayload, TableStatePayload,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TableSortPayload, TableStatePayload,
TableSortPayload,
TableStatePayload,

nit

@@ -228,7 +239,7 @@ const props = defineProps({
* @param {Array} options.data - Array of Objects defining column data
*/
options: {
type: Object,
type: Object as PropType<TableOptions>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have concerns about breaking existin implementations by making the prop types too strict. We want to avoid making users typecast as much as possible in the host app. Having to do things like
image
everywhere is not a great DX.

Can we keep the types loose in the prop defs and have the strict types on a local copy of the prop? We can just cast to the correct type like we do for our handling of the headers prop:

https://github.com/Kong/kongponents/blob/main/src/components/KTable/KTable.vue#L729

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried this new PR in khcp-ui and shared-ui, no ts errors

@adamdehaven
Copy link
Collaborator

@DariaYeremina what do we need to do to get this PR merged?

@DariaYeremina DariaYeremina force-pushed the feat/KHCP-6973-fe-add-types-for-table branch from 5c6fd22 to f0ce39b Compare July 13, 2023 15:08
@DariaYeremina DariaYeremina force-pushed the feat/KHCP-6973-fe-add-types-for-table branch from f0ce39b to a6323a0 Compare July 13, 2023 15:08
Copy link
Collaborator

@adamdehaven adamdehaven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will cause ts errors in khcp-ui and potentially shared-ui-components and public-ui-components

Can you expand on this a bit more? What will be the issues?

@DariaYeremina
Copy link
Contributor Author

Will cause ts errors in khcp-ui and potentially shared-ui-components and public-ui-components

Can you expand on this a bit more? What will be the issues?

With today's fixes there's no ts errors in hosted apps

@DariaYeremina DariaYeremina force-pushed the feat/KHCP-6973-fe-add-types-for-table branch from a6323a0 to 2251b10 Compare August 1, 2023 13:25
@DariaYeremina DariaYeremina enabled auto-merge (squash) August 1, 2023 13:34
@DariaYeremina DariaYeremina merged commit 461aec6 into main Aug 1, 2023
5 checks passed
@DariaYeremina DariaYeremina deleted the feat/KHCP-6973-fe-add-types-for-table branch August 1, 2023 13:35
kongponents-bot pushed a commit that referenced this pull request Aug 1, 2023
# [8.120.0](v8.119.0...v8.120.0) (2023-08-01)

### Features

* **KTable:** add types [KHCP-6973] ([#1457](#1457)) ([461aec6](461aec6))
@kongponents-bot
Copy link
Collaborator

🎉 This PR is included in version 8.120.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants