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

[WIP] ♻️ (typescript) convert TransactionListWithBalances.jsx to .tsx #3876

Conversation

cindywu
Copy link

@cindywu cindywu commented Nov 22, 2024

#1483

  • converts CategoryTransactions.jsx to .tsx
  • updates AccountTransactions.tsx

@cindywu cindywu changed the title wip [WIP] ♻️ (typescript) convert TransactionListWIthBalances.jsx to .tsx Nov 22, 2024
Copy link

netlify bot commented Nov 22, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 0451d1d
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/67415cda0f35f0000849c443
😎 Deploy Preview https://deploy-preview-3876.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 Nov 22, 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
10 5.45 MB → 5.45 MB (+242 B) +0.00%
Changeset
File Δ Size
src/components/mobile/transactions/TransactionListWithBalances.tsx 🆕 +5.45 kB 0 B → 5.45 kB
src/components/mobile/accounts/AccountTransactions.tsx 📈 +75 B (+0.99%) 7.43 kB → 7.51 kB
src/components/mobile/transactions/TransactionListWithBalances.jsx 🔥 -5.29 kB (-100%) 5.29 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.44 MB → 3.44 MB (+167 B) +0.00%
static/js/narrow.js 82.93 kB → 83 kB (+75 B) +0.09%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/useAccountPreviewTransactions.js 1.68 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/AppliedFilters.js 21.32 kB 0%
static/js/workbox-window.prod.es5.js 5.69 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/wide.js 241.19 kB 0%
static/js/ReportRouter.js 1.52 MB 0%

Copy link
Contributor

github-actions bot commented Nov 22, 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.32 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.32 MB 0%

@cindywu cindywu changed the title [WIP] ♻️ (typescript) convert TransactionListWIthBalances.jsx to .tsx [WIP] ♻️ (typescript) convert TransactionListWithBalances.jsx to .tsx Nov 22, 2024
@@ -314,16 +315,20 @@ function TransactionListWithPreviews({
);

const transactionsToDisplay = !isSearching
? previewTransactions.concat(transactions)
Copy link
Author

Choose a reason for hiding this comment

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

The original code was resulting in a readonly version of transactions.

Copy link
Contributor

Choose a reason for hiding this comment

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

That is intentional. We should instead update transactions prop of TransactionListWithBalances as readonly

marginTop: 10,
}}
>
<>
Copy link
Author

@cindywu cindywu Nov 22, 2024

Choose a reason for hiding this comment

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

The only change here is I wrapped the two children in a <></> so that there is only a single child inside <SelectedProvider></SelectedProvider>. I did not touch the components inside the <></>

@cindywu
Copy link
Author

cindywu commented Nov 22, 2024

This is probably ready for review, but let me do one more pass tomorrow.

@@ -247,9 +248,9 @@ function TransactionListWithPreviews({
const dispatch = useDispatch();
const navigate = useNavigate();

const onRefresh = useCallback(() => {
const onRefresh = useCallback(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this need to be async?

@@ -314,16 +315,20 @@ function TransactionListWithPreviews({
);

const transactionsToDisplay = !isSearching
? previewTransactions.concat(transactions)
Copy link
Contributor

Choose a reason for hiding this comment

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

That is intentional. We should instead update transactions prop of TransactionListWithBalances as readonly

@@ -57,6 +66,19 @@ function TransactionSearchInput({ placeholder, onSearch }) {
);
}

type TransactionListWithBalancesProps = {
isLoading: boolean | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
isLoading: boolean | undefined;
isLoading?: boolean;

@@ -57,6 +66,19 @@ function TransactionSearchInput({ placeholder, onSearch }) {
);
}

type TransactionListWithBalancesProps = {
isLoading: boolean | undefined;
transactions: TransactionEntity[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
transactions: TransactionEntity[];
transactions: readonly TransactionEntity[];

balanceCleared,
balance,
}: {
balanceUncleared: SheetFields<SheetNames>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make a BalanceWithClearedProps type

@@ -170,7 +202,7 @@ function BalanceWithCleared({ balanceUncleared, balanceCleared, balance }) {
);
}

function Balance({ balance }) {
function Balance({ balance }: { balance: SheetFields<SheetNames> }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make a BalanceProps

balanceUncleared={balanceQueries.uncleared}
balance={balanceQueries.balance.name as SheetFields<SheetNames>}
balanceCleared={
(balanceQueries.cleared?.name as SheetFields<SheetNames>) ?? undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

This will change the behavior. This is ignoring the query property of the binding. These should be Bindings instead.

Copy link
Contributor

github-actions bot commented Dec 3, 2024

👋 Hi! It looks like this PR has not had any changes for a week now. Would you like someone to review this PR? If so - please remove the "[WIP]" prefix from the PR title. That will let the community know that this PR is open for a review.

@github-actions github-actions bot added the Stale label Dec 3, 2024
Copy link
Contributor

github-actions bot commented Dec 8, 2024

This PR was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants