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

migrate BudgetList to typescript #3026

Merged

Conversation

tcrasset
Copy link
Contributor

@tcrasset tcrasset commented Jul 10, 2024

Relates to #1483

@github-actions github-actions bot changed the title migrate BudgetList to typescript [WIP] migrate BudgetList to typescript Jul 10, 2024
Copy link

netlify bot commented Jul 10, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 54cc2fa
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/668efb8fee32fc0008bb8e2c
😎 Deploy Preview https://deploy-preview-3026.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
Contributor

github-actions bot commented Jul 10, 2024

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 4.95 MB → 4.95 MB (+250 B) +0.00%
Changeset
File Δ Size
src/components/manager/BudgetList.tsx 🆕 +10.14 kB 0 B → 10.14 kB
home/runner/work/actual/actual/packages/loot-core/src/client/reducers/budgets.ts 📈 +70 B (+2.21%) 3.09 kB → 3.16 kB
src/components/manager/BudgetList.jsx 🔥 -9.97 kB (-100%) 9.97 kB → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 3.2 MB → 3.2 MB (+250 B) +0.01%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/narrow.js 76.15 kB 0%
static/js/AppliedFilters.js 27.5 kB 0%
static/js/usePreviewTransactions.js 790 B 0%
static/js/wide.js 272.26 kB 0%
static/js/ReportRouter.js 1.23 MB 0%

Copy link
Contributor

github-actions bot commented Jul 10, 2024

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.13 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.js 1.13 MB 0%

@tcrasset tcrasset force-pushed the tc/migrate-budgetlist-typescript branch from 2ebfdf5 to 54cc2fa Compare July 10, 2024 21:22
@tcrasset tcrasset changed the title [WIP] migrate BudgetList to typescript migrate BudgetList to typescript Jul 10, 2024
Comment on lines +360 to +367
// Remote files do not have the 'id' field
function isNonRemoteFile(
file: File,
): file is LocalFile | SyncableLocalFile | SyncedLocalFile {
return file.state !== 'remote';
}
const nonRemoteFiles = allFiles.filter(isNonRemoteFile);
const files = id ? nonRemoteFiles.filter(f => f.id !== id) : allFiles;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't know if I should do this or check file.cloudFileId if it's a RemoteFile. I've just kept the things in their current form. I haven't thought much about the logic behind it all

Comment on lines 11 to 21
export type LocalFile = Omit<Budget, 'cloudFileId' | 'groupId'> & {
state: 'local';
hasKey: boolean;
};

export type SyncableLocalFile = Budget & {
cloudFileId: string;
groupId: string;
state: 'broken' | 'unknown';
hasKey: boolean;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

File.hasKey was used a few times in BudgetList.jsx. I don't know how the logic for hasKey is determined for local files. Can they be encrypted? If yes, why didn't they have the hasKey property? I chose to add it, and default it to True. That's because, in my view, if the file is imported locally, and is encrypted, if the user managed to import it, it means he has the key.

Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

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

Thanks!

@MatissJanis MatissJanis merged commit 572033d into actualbudget:master Jul 13, 2024
21 checks passed
@tcrasset tcrasset deleted the tc/migrate-budgetlist-typescript branch July 15, 2024 21:58
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.

2 participants