Skip to content

Conversation

@AlanGreene
Copy link
Member

@AlanGreene AlanGreene commented Jun 18, 2024

Changes

Related to #2452

There will be be at least one additional PR to refactor some of the remaining resource list / resource details containers and move the configuration of the resource GVK to the routes instead of using custom API hooks.

This is all part of a greater effort to reduce boilerplate, which reduces the maintenance overhead for each additional resource type added, and in turn reduces the barrier to entry for contributors as the code is much simplified and easier to modify. It will also provide greater consistency across resources in terms of layout, functionality, etc. Some resources such as *Runs are likely to remain quite different due to the additional content associated with them, but will be able to leverage the simplified config to reduce the amount of custom code required for each of their views.

/kind misc

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (new features, significant UI changes, API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

This is required to use the `handle` route prop which will be used
to replace custom routes such as `NamespacedRoute`, `ReadWriteRoute`,
and allow for more centralised processing of most API requests via
React Query's default query function.
This is a step towards using React Query's default query function
which will allow us to remove many of the custom API functions,
hooks, etc.

While this introduces a slight increase in the amount of code, this
is temporary and will ultimately allow for a significant reduction
in the amount of boilerplace code required across the application.
It will allow for removal of most of the custom hooks for loading
resources (both lists and single items) as well as removal of much
of the custom websocket handling code.
Switch from custom `NamespacedRoute` wrapper container to the
natively supported `handle` route prop.

This `handle` prop will be used further with the React Query
default query function to reduce the amount of boilerplate code
required for each route / resource, particularly at the API layer.
@tekton-robot tekton-robot added kind/misc Categorizes issue or PR as a miscellaneuous one. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 18, 2024
@tekton-robot tekton-robot requested review from LyndseyBu and skaegi June 18, 2024 09:00
@AlanGreene AlanGreene requested review from briangleeson and removed request for skaegi June 18, 2024 09:01
Copy link
Contributor

@briangleeson briangleeson left a comment

Choose a reason for hiding this comment

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

Thanks for the walkthrough. Couple of nits but otherwise looks good overall

Implement and use React Query's default query function to reduce
the amount of API boilerplate required per resource kind.

Also switch to the new model of calling useQuery with a single
object containing `queryKey` etc. since that's the only approach
supported in the next major version of React Query.
Copy link
Contributor

@briangleeson briangleeson left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 24, 2024
@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: briangleeson

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 24, 2024
@tekton-robot tekton-robot merged commit 38a77eb into tektoncd:main Jun 24, 2024
@AlanGreene AlanGreene deleted the react-router-data-router branch June 24, 2024 14:12
@AlanGreene AlanGreene mentioned this pull request Jul 3, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants