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

🐛 (synced-prefs) fix bulk-reading not working in import modal #3460

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

MatissJanis
Copy link
Member

Reproduction:

  1. attempt to import this csv file
  2. edge will crash; the current PR should work

@actual-github-bot actual-github-bot bot changed the title 🐛 (synced-prefs) fix bulk-reading not working in import modal [WIP] 🐛 (synced-prefs) fix bulk-reading not working in import modal Sep 17, 2024
Copy link

netlify bot commented Sep 17, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 4c3306d
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/66e9f545e1cfa4000827bfbe
😎 Deploy Preview https://deploy-preview-3460.demo.actualbudget.org
📱 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

coderabbitai bot commented Sep 17, 2024

Walkthrough

The pull request introduces several changes aimed at improving the functionality and reliability of the codebase. Key modifications include enhancements to the useSyncedPrefs function to handle potential null or undefined values in queryData, and an update to the useQuery function's return type to allow for null data. Additionally, a new file addresses a bugfix related to the synchronization of imported preferences.

Changes

Files Change Summary
packages/desktop-client/src/hooks/useSyncedPrefs.ts Updated useSyncedPrefs to use a nullish coalescing operator for queryData, ensuring it defaults to an empty array if null or undefined.
packages/loot-core/src/client/query-hooks.tsx Modified the return type of data in useQuery from Response to `null
upcoming-release-notes/3460.md Added a bugfix note for SyncedPrefs, correcting issues with the import of preferences.

Possibly related PRs

Suggested labels

:sparkles: Merged

Poem

🐰 In the code where bunnies hop,
Changes made, we’ll never stop!
Preferences synced, bugs now fixed,
With every line, our joy is mixed.
So here’s to code, so bright and new,
A happy hop for me and you! 🐇✨


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 17fd068 and 4c3306d.

Files selected for processing (3)
  • packages/desktop-client/src/hooks/useSyncedPrefs.ts (1 hunks)
  • packages/loot-core/src/client/query-hooks.tsx (1 hunks)
  • upcoming-release-notes/3460.md (1 hunks)
Additional comments not posted (3)
upcoming-release-notes/3460.md (1)

1-6: LGTM!

The release notes follow the standard format and accurately describe the bugfix. The category and author metadata are correctly specified. The one-line description matches the information provided in the PR objectives and the AI-generated summary.

packages/desktop-client/src/hooks/useSyncedPrefs.ts (1)

19-19: LGTM!

The use of the nullish coalescing operator (??) is a good way to provide a fallback empty array if queryData is null or undefined. This ensures that the reduce method is always called on an array, preventing potential runtime errors.

The change improves the robustness and reliability of the code by handling edge cases where queryData may not be initialized.

packages/loot-core/src/client/query-hooks.tsx (1)

85-85: Approve the change to the return type of the data property.

The modification to the return type of the data property from Response to null | Response enhances the flexibility of the useQuery hook. It allows the hook to represent scenarios where data is not yet available, which is a common case in asynchronous data fetching operations.

Request more information on how this change relates to the PR objective.

While the change itself seems reasonable, it's unclear how it directly relates to the PR objective of fixing the bulk-reading functionality not working in the import modal. Could you please provide more context on how this modification resolves the reported issue of the Edge browser crashing during the import process?


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>, please review it.
    -- 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 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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
9 5.18 MB → 5.18 MB (-3.17 kB) -0.06%
Changeset
File Δ Size
src/hooks/useSyncedPrefs.ts 📈 +8 B (+1.47%) 545 B → 553 B
home/runner/work/actual/actual/packages/loot-core/src/shared/rules.ts 📉 -73 B (-1.10%) 6.48 kB → 6.41 kB
src/components/modals/EditRuleModal.jsx 📉 -1.67 kB (-4.29%) 38.94 kB → 37.27 kB
src/components/settings/Experimental.tsx 📉 -233 B (-4.80%) 4.74 kB → 4.51 kB
src/hooks/useFeatureFlag.ts 📉 -27 B (-7.28%) 371 B → 344 B
src/components/rules/ActionExpression.tsx 📉 -375 B (-9.12%) 4.01 kB → 3.65 kB
src/icons/v1/Code.tsx 🔥 -448 B (-100%) 448 B → 0 B
src/icons/v1/AlignLeft.tsx 🔥 -387 B (-100%) 387 B → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset File Size % Changed
static/js/index.js 3.21 MB → 3.21 MB (-3.17 kB) -0.10%

Unchanged

Asset File Size % Changed
static/js/resize-observer.js 18.37 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 80.62 kB 0%
static/js/usePreviewTransactions.js 1.59 kB 0%
static/js/AppliedFilters.js 20.97 kB 0%
static/js/wide.js 225.21 kB 0%
static/js/ReportRouter.js 1.5 MB 0%

Copy link
Contributor

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.26 MB → 1.19 MB (-74.56 kB) -5.76%
Changeset
File Δ Size
packages/loot-core/src/shared/rules.ts 📉 -83 B (-0.92%) 8.8 kB → 8.72 kB
packages/loot-core/src/server/accounts/rules.ts 📉 -2.85 kB (-8.45%) 33.74 kB → 30.88 kB
node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js 🔥 -200.84 kB (-100%) 200.84 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js 🔥 -118.53 kB (-100%) 118.53 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js 🔥 -56.75 kB (-100%) 56.75 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/runtime.js 🔥 -43.72 kB (-100%) 43.72 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js 🔥 -22.62 kB (-100%) 22.62 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js 🔥 -18.76 kB (-100%) 18.76 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js 🔥 -15.51 kB (-100%) 15.51 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js 🔥 -12.33 kB (-100%) 12.33 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/utils.js 🔥 -10.07 kB (-100%) 10.07 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/each.js 🔥 -9.64 kB (-100%) 9.64 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/base.js 🔥 -9.41 kB (-100%) 9.41 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js 🔥 -8.29 kB (-100%) 8.29 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/exception.js 🔥 -5.81 kB (-100%) 5.81 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars.js 🔥 -4.79 kB (-100%) 4.79 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars.runtime.js 🔥 -4.5 kB (-100%) 4.5 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/if.js 🔥 -4.35 kB (-100%) 4.35 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/base.js 🔥 -3.83 kB (-100%) 3.83 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers.js 🔥 -3.82 kB (-100%) 3.82 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/logger.js 🔥 -3.79 kB (-100%) 3.79 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/block-helper-missing.js 🔥 -3.74 kB (-100%) 3.74 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/with.js 🔥 -3.67 kB (-100%) 3.67 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js 🔥 -3.34 kB (-100%) 3.34 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js 🔥 -2.63 kB (-100%) 2.63 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/log.js 🔥 -2.45 kB (-100%) 2.45 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/no-conflict.js 🔥 -2.45 kB (-100%) 2.45 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js 🔥 -2.14 kB (-100%) 2.14 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js 🔥 -1.97 kB (-100%) 1.97 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/internal/create-new-lookup-object.js 🔥 -1.74 kB (-100%) 1.74 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/lookup.js 🔥 -1.21 kB (-100%) 1.21 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/safe-string.js 🔥 -1.14 kB (-100%) 1.14 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/decorators.js 🔥 -1000 B (-100%) 1000 B → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset File Size % Changed
kcab.worker.js 1.26 MB → 1.19 MB (-74.56 kB) -5.76%

Unchanged

No assets were unchanged

@MatissJanis MatissJanis changed the title [WIP] 🐛 (synced-prefs) fix bulk-reading not working in import modal 🐛 (synced-prefs) fix bulk-reading not working in import modal Sep 17, 2024
@MikesGlitch
Copy link
Contributor

I get "no transactions found" with the test file

image

Copy link
Contributor

@jfdoming jfdoming left a comment

Choose a reason for hiding this comment

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

Confirmed working with this PR and not in edge. But maybe worth looking into what happened above as well

@UnderKoen
Copy link
Contributor

UnderKoen commented Sep 18, 2024

I get "no transactions found" with the test file

This is due to some loops in dependecies. Is fixxed this in #3456

@MatissJanis MatissJanis merged commit ea675f1 into master Sep 18, 2024
20 checks passed
@MatissJanis MatissJanis deleted the matiss/synced-prefs-9 branch September 18, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants