Skip to content

Conversation

@mertmit
Copy link
Member

@mertmit mertmit commented Jun 29, 2024

Change Summary

Fixes #8667

  • Send all columns on delete & update webhook

Change type

  • fix: (bug fix for the user, not a fix to a build script)

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 29, 2024

Walkthrough

Walkthrough

The recent updates to the BaseModelSqlv2 class in packages/nocodb/src/db/BaseModelSqlv2.ts include the introduction of a new parameter, ignoreViewFilterAndSort, set to true at two different locations within the class. This change aims to ensure that all columns are included in the webhook delete payload, addressing the bug in issue #8667 where only visible columns were being sent.

Changes

File Path Change Summary
packages/nocodb/src/db/BaseModelSqlv2.ts Added ignoreViewFilterAndSort: true parameter in two code sections

Sequence Diagram(s)

No sequence diagrams are needed because the changes are limited to adding a new parameter and do not significantly alter the control flow.

Assessment against linked issues

Objective Addressed Explanation
All columns should be sent in the webhook payload after a delete operation (#8667)

Tip

Early access features
  • OpenAI gpt-4o model for reviews and chat.

Note:

  • You can disable early access features from the CodeRabbit UI or by setting early_access: false in the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are always opted into early access features.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (20)
packages/nocodb/src/db/BaseModelSqlv2.ts (20)

Line range hint 498-498: Use Optional Chaining

Consider using optional chaining to handle potential null or undefined values.

-  const colOptions = await column.getColOptions<LinkToAnotherRecordColumn>(this.context);
+  const colOptions = await column?.getColOptions<LinkToAnotherRecordColumn>(this.context);

Line range hint 1458-1458: Remove Redundant Catch Clause

The catch clause that only rethrows the original error is redundant and can be removed.

-  } catch (e) {
-    throw e;
-  }

Line range hint 1538-1538: Remove Redundant Catch Clause

The catch clause that only rethrows the original error is redundant and can be removed.

-  } catch (e) {
-    throw e;
-  }

Line range hint 1592-1592: Remove Redundant Catch Clause

The catch clause that only rethrows the original error is redundant and can be removed.

-  } catch (e) {
-    throw e;
-  }

Line range hint 2013-2013: Use Optional Chaining

Consider using optional chaining to handle potential null or undefined values.

-  const colOptions = await column.getColOptions<LinkToAnotherRecordColumn>(this.context);
+  const colOptions = await column?.getColOptions<LinkToAnotherRecordColumn>(this.context);

Line range hint 2095-2095: Use Optional Chaining

Consider using optional chaining to handle potential null or undefined values.

-  const colOptions = await column.getColOptions<LinkToAnotherRecordColumn>(this.context);
+  const colOptions = await column?.getColOptions<LinkToAnotherRecordColumn>(this.context);

Line range hint 2259-2259: Use Optional Chaining

Consider using optional chaining to handle potential null or undefined values.

-  const colOptions = await column.getColOptions<LinkToAnotherRecordColumn>(this.context);
+  const colOptions = await column?.getColOptions<LinkToAnotherRecordColumn>(this.context);

Line range hint 2469-2469: Use Optional Chaining

Consider using optional chaining to handle potential null or undefined values.

-  const colOptions = await column.getColOptions<LinkToAnotherRecordColumn>(this.context);
+  const colOptions = await column?.getColOptions<LinkToAnotherRecordColumn>(this.context);

Line range hint 2608-2618: Omit Unnecessary Else Clause

The else clause can be omitted because previous branches break early.

-  } else {
-    await this.applySortAndFilter({
-      table: childTable,
-      where,
-      qb,
-      sort,
-    });
-  }

Line range hint 2649-2659: Omit Unnecessary Else Clause

The else clause can be omitted because previous branches break early.

-  } else {
-    await this.applySortAndFilter({
-      table: childTable,
-      where,
-      qb,
-      sort,
-    });
-  }

Line range hint 2871-2883: Omit Unnecessary Else Clause

The else clause can be omitted because previous branches break early.

-  } else {
-    await this.applySortAndFilter({
-      table: childTable,
-      where,
-      qb,
-      sort,
-    });
-  }

Line range hint 3036-3063: Omit Unnecessary Else Clause

The else clause can be omitted because previous branches break early.

-  } else {
-    await this.applySortAndFilter({
-      table: childTable,
-      where,
-      qb,
-      sort,
-    });
-  }

Line range hint 3580-3588: Omit Unnecessary Else Clause

The else clause can be omitted because previous branches break early.

-  } else {
-    await this.applySortAndFilter({
-      table: childTable,
-      where,
-      qb,
-      sort,
-    });
-  }

Line range hint 3586-3588: Omit Unnecessary Else Clause

The else clause can be omitted because previous branches break early.

-  } else {
-    await this.applySortAndFilter({
-      table: childTable,
-      where,
-      qb,
-      sort,
-    });
-  }

Line range hint 3783-3783: Remove Redundant Catch Clause

The catch clause that only rethrows the original error is redundant and can be removed.

-  } catch (e) {
-    throw e;
-  }

Line range hint 3803-3825: Omit Unnecessary Else Clause

The else clause can be omitted because previous branches break early.

-  } else {
-    await this.applySortAndFilter({
-      table: childTable,
-      where,
-      qb,
-      sort,
-    });
-  }

Line range hint 3819-3824: Omit Unnecessary Else Clause

The else clause can be omitted because previous branches break early.

-  } else {
-    await this.applySortAndFilter({
-      table: childTable,
-      where,
-      qb,
-      sort,
-    });
-  }

Line range hint 4435-4440: Place Default Parameter After Required Parameters

The default parameter should follow the last required parameter or should be a required parameter to avoid issues at the call site.

-  async bulkInsert(
-    datas: any[],
-    {
-      chunkSize: _chunkSize = 100,
-      cookie,
-      foreign_key_checks = true,
-      skip_hooks = false,
-      raw = false,
-      insertOneByOneAsFallback = false,
-      isSingleRecordInsertion = false,
-      allowSystemColumn = false,
-    }: {
-      chunkSize?: number;
-      cookie?: any;
-      foreign_key_checks?: boolean;
-      skip_hooks?: boolean;
-      raw?: boolean;
-      insertOneByOneAsFallback?: boolean;
-      isSingleRecordInsertion?: boolean;
-      allowSystemColumn?: boolean;
-    } = {},
+  async bulkInsert(
+    datas: any[],
+    options: {
+      chunkSize?: number;
+      cookie?: any;
+      foreign_key_checks?: boolean;
+      skip_hooks?: boolean;
+      raw?: boolean;
+      insertOneByOneAsFallback?: boolean;
+      isSingleRecordInsertion?: boolean;
+      allowSystemColumn?: boolean;
+    } = { chunkSize: 100 },
  ) {
    const {
      chunkSize = 100,
      cookie,
      foreign_key_checks = true,
      skip_hooks = false,
      raw = false,
      insertOneByOneAsFallback = false,
      isSingleRecordInsertion = false,
      allowSystemColumn = false,
    } = options;

Line range hint 4521-4521: Remove Redundant Catch Clause

The catch clause that only rethrows the original error is redundant and can be removed.

-  } catch (e) {
-    throw e;
-  }

Line range hint 4829-4829: Remove Redundant Catch Clause

The catch clause that only rethrows the original error is redundant and can be removed.

-  } catch (e) {
-    throw e;
-  }
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 254972c and ddaf363.

Files selected for processing (1)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
Additional context used
Biome
packages/nocodb/src/db/BaseModelSqlv2.ts

[error] 498-498: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1458-1458: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 1538-1538: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 1592-1592: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 2013-2013: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 2095-2095: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 2259-2259: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 2469-2469: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 2608-2618: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 2649-2659: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 2871-2883: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 3036-3063: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 3580-3588: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 3586-3588: This else clause can be omitted because previous branches break early.

(lint/style/noUselessElse)


[error] 3783-3783: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 3803-3825: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 3819-3824: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 4435-4440: This default parameter should follow the last required parameter or should be a required parameter.

The last required parameter is here:

A default parameter that precedes a required parameter cannot be omitted at call site.
Unsafe fix: Turn the parameter into a required parameter.

(lint/style/useDefaultParameterLast)


[error] 4521-4521: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 4829-4829: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

@github-actions
Copy link
Contributor

github-actions bot commented Jun 29, 2024

Uffizzi Preview deployment-53648 was deleted.

@dstala dstala merged commit 3df5929 into develop Jun 29, 2024
@dstala dstala deleted the nc-fix/8667-wh-pay branch June 29, 2024 08:12
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.

🐛 Bug: Webhook delete payload is only visible columns

3 participants