-
Notifications
You must be signed in to change notification settings - Fork 2
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
Implement board versioning and add mutation for updating board view state #30
Conversation
This commit implements mechanisms needed to modify a board's view state. A new GraphQL mutation, `addItemToViewState`, has been added. The backend `package.json` was modified to include `[email protected]` for sorting utilities. Changes have also been made to various resolvers, and some code was commented out for later adjustments.
Cleaned up the KanbanBoard component by eliminating unused imports, queries, state fields, and methods. This simplifies the code, making it easier to maintain and understand. Removed unnecessary mutations like UPDATE_BOARD_MUTATION and redundant hooks like useLazyQuery. This refactoring ensures only relevant dependencies and state values remain in use.
There were significant changes in the way the 'boards' resolver handled fetching boards. We refactored the resolver from the project's code to a shared function, ensuring to take into account if the parent type is a Project. Additionally, the function is now exported directly from the 'board' resolver's index file. This should improve readability and maintainability in the long run.
Removed unused type imports in the board index resolver file. "Maybe", "ResolversObject", and "ResolversTypes" were decluttered to streamline the code base and improve readability.
The update consists of reworking code in several index.ts files to perform database operations within transactions, ensuring atomicity. This is mainly implemented in board and issue resolvers, where multiple actions are performed within the same code block. This ensures consistency and rollbacks in case of any errors occurring during the operations.
The commit eliminates large portions of commented code in the issue resolver file, 'index.ts'. This helps to streamline the codebase and reduce clutter, enhancing readability and overall code maintenance.
The sequence of import statements in Item and Container components under KanbanBoard has been revised for a cleaner code organization. External dependencies now precede internal dependencies in order to provide consistency and enhance readability.
The comments referencing a GitHub link and a personal compliment were removed from the KanbanBoard's index.tsx file. These comments were not providing any significant context or crucial information for the understanding or functioning of the code.
This commit introduces the 'AddItemToViewState' mutation to the graphql schema and modifies board resolver logic. It ensures that a new item can be added to a given view state by manipulating the view state's positional index. The changes include validation checks for the 'columnPositionIndex' and different handling for existing and new items. This update enhances the functionality, making the system more dynamic and flexible.
The code for reordering container items has been adjusted to use row level locking for improved concurrency control. This has been achieved by replacing the previous sorting method with an SQL query that includes a lock and transaction. This change is currently being tested.
The code disables data pre-loading in the resolvers and refetching for WebSocket messages in frontend services. This change was made to prevent a possible performance issue. However, the impact on the system's overall performance and functionality should be carefully monitored and evaluated.
Included an asynchronous refetch function onCompleted in the KanbanBoard component. This is to ensure that the most recent project information is displayed, though additional review is needed to confirm its necessity.
The underlying logic for updating an issue's status in the Kanban board has been modified. An additional early exit condition has been introduced when the containers array is empty. The refetching of project info upon completion of updating issues has been modified and simplified for efficiency. Moreover, the logic has been restructured to enhance readability and maintainability.
The code modifications update how issue status is changed - it now involves actions specific to the issue board. Moreover, they ensure data consistency by checking for remote data changes on the Kanban board page and updating the page state accordingly. This adjustment helps prevent any discrepancies caused by stale data.
A new version field has been added to the board table in the database. This new field has been incorporated into the backend and frontend, and it is reflected in all related graphql queries and type definitions.
In the KanbanBoard component, a new function has been added to increment the boardVersion state whenever a new item is completed and added to the board. This ensures that the version of the board is always up-to-date after an item is added.
The updated code removes unnecessary comments and simplifies the behavior when remote data changes. Superfluous logs and checks have been minimized. The complexity of the code related to issue handling and board states are greatly reduced, making the functionality clearer. The changes improve code readability and maintainability.
/describe |
PR Analysis
PR Feedback💡 General suggestions: The PR introduces a comprehensive set of changes that are well-scoped to the task of improving the Kanban board's view state management. It is recommended to ensure thorough testing, particularly around the database migrations and the new transaction handling in the backend resolvers. Additionally, consider verifying the frontend behavior to ensure that the new state management logic aligns with user expectations and that the UI updates reflect the backend changes accurately. 🤖 Code feedback:
✨ Usage guide:Overview:
With a configuration file, use the following template:
See the review usage page for a comprehensive guide on using this tool. |
PR Description updated to latest commit (e331806) |
Type
enhancement, bug_fix
Description
addItemToViewState
to handle adding items to the board's view state.IssueStatusDropdown
component and the socket message handler.array-move
package to dependencies for array manipulation utilities.Changes walkthrough
18 files
gql.ts
frontend/gql/__generated__/gql.ts
Added a new GraphQL mutation
addItemToViewState
andincluded the
version
field in theProjectFields
fragmentfor boards.
index.tsx
frontend/components/KanbanBoard/index.tsx
Refactored the
KanbanBoard
component to use the newaddItemToViewState
mutation, removed unnecessary code, andupdated the logic to handle board versioning.
index.ts
backend/src/resolvers/issue/index.ts
Refactored the issue resolver to handle database
transactions for atomicity and consistency, and to update
the board version and view state when an issue is updated.
resolvers-types.ts
backend/src/__generated__/resolvers-types.ts
Updated the generated types to include the new
AddItemToViewStateItemInput
and related types for the newmutation.
index.ts
backend/src/resolvers/board/index.ts
Added new resolvers for creating view states and adding
items to view states on the board, and updated existing
resolvers to handle board versioning.
index.ts
backend/src/resolvers/project/index.ts
Updated the project resolvers to create default board
containers when a new project is created.
types.ts
backend/src/db/models/types.ts
Added new model types for
BoardContainer
andContainerItem
to support the new board view statestructure.
20240113143058-create-board-item-tables.ts
backend/src/db/migrations/20240113143058-create-board-item-tables.ts
Added a new database migration to create tables for board
containers and container items.
gql-queries-mutations.ts
frontend/gql/gql-queries-mutations.ts
Added the
ADD_ITEM_TO_VIEW_STATE
mutation to the GraphQLqueries and mutations file.
apollo-client.ts
frontend/services/apollo-client.ts
Updated the Apollo client configuration to handle file
uploads and batched queries and mutations.
type-defs.ts
backend/src/type-defs.ts
Updated GraphQL type definitions to include the new
mutations for managing view states on the board.
container-item.ts
backend/src/db/models/container-item.ts
**Added a new Sequelize model for container items.
**
board-container.ts
backend/src/db/models/board-container.ts
**Added a new Sequelize model for board containers.
**
board.ts
backend/src/db/models/board.ts
Updated the board model to include a version field and
associated containers.
index.ts
backend/src/db/models/index.ts
Updated the database models index file to include the new
BoardContainer
andContainerItem
models.issue.ts
backend/src/db/models/issue.ts
Updated the issue model to associate with the
IssueStatuses
model.typings.ts
backend/src/typings.ts
Updated typings to include the new
BoardContainer
andContainerItem
types.20240116200136-add-version-to-board-table.ts
backend/src/db/migrations/20240116200136-add-version-to-board-table.ts
Added a new database migration to add a version field to the
board table.
1 files
codegen.ts
backend/codegen.ts
Commented out the post-processing hooks in the code
generation configuration file.
2 files
IssueStatusDropdown.tsx
frontend/components/IssueModal/IssueStatusDropdown.tsx
Updated the
IssueStatusDropdown
component to use anetwork-only fetch policy when refetching queries.
socket-handlers.ts
frontend/services/socket-handlers.ts
Commented out the refetching of queries in the socket
message handler to avoid conflicts with board state.
2 files
index.tsx
frontend/components/KanbanBoard/Item/index.tsx
**Minor import reordering in the
Item
component.**
index.tsx
frontend/components/KanbanBoard/Container/index.tsx
**Minor import reordering in the
Container
component.**
2 files
pnpm-lock.yaml
backend/pnpm-lock.yaml
Updated the lock file to include the new
array-move
dependency.
package.json
backend/package.json
**Added the
array-move
package to the dependencies.**
✨ Usage guide:
Overview:
The
describe
tool scans the PR code changes, and generates a description for the PR - title, type, summary, walkthrough and labels. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.When commenting, to edit configurations related to the describe tool (
pr_description
section), use the following template:With a configuration file, use the following template:
Enabling\disabling automation
meaning the
describe
tool will run automatically on every PR, will keep the original title, and will add the original user description above the generated description.the tool will replace every marker of the form
pr_agent:marker_name
in the PR description with the relevant content, wheremarker_name
is one of the following:type
: the PR type.summary
: the PR summary.walkthrough
: the PR walkthrough.Note that when markers are enabled, if the original PR description does not contain any markers, the tool will not alter the description at all.
Custom labels
The default labels of the
describe
tool are quite generic: [Bug fix
,Tests
,Enhancement
,Documentation
,Other
].If you specify custom labels in the repo's labels page or via configuration file, you can get tailored labels for your use cases.
Examples for custom labels:
Main topic:performance
- pr_agent:The main topic of this PR is performanceNew endpoint
- pr_agent:A new endpoint was added in this PRSQL query
- pr_agent:A new SQL query was added in this PRDockerfile changes
- pr_agent:The PR contains changes in the DockerfileThe list above is eclectic, and aims to give an idea of different possibilities. Define custom labels that are relevant for your repo and use cases.
Note that Labels are not mutually exclusive, so you can add multiple label categories.
Make sure to provide proper title, and a detailed and well-phrased description for each label, so the tool will know when to suggest it.
Utilizing extra instructions
The
describe
tool can be configured with extra instructions, to guide the model to a feedback tailored to the needs of your project.Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Notice that the general structure of the description is fixed, and cannot be changed. Extra instructions can change the content or style of each sub-section of the PR description.
Examples for extra instructions:
Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.
More PR-Agent commands
See the describe usage page for a comprehensive guide on using this tool.