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

feat(@wallet): update collectibles model only with changes #13544

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

dlipicar
Copy link
Contributor

@dlipicar dlipicar commented Feb 13, 2024

Fixes #13254

What does the PR do

Whenever a change in the list of owned collectibles is reported by status-go, we now update the model with the delta (added/removed items) instead of doing a full reset, which should help avoid doing unnecessary work in the SFPM.

This is a straightforward approach, and there's room for improvement still:

  • Don't re-request the full list from status-go, only request new items and remove what's needed.
    • I considered this originally, but the complexity became quite high (similar to what Stefan's doing for the Session-Based Activity API). It was taking too long and I feared inconsistencies between the two lists, so I abandoned this idea for now.
  • Separate models with collectibles metadata (most of what we currently have) and ownership (accounts + uids), which can be combined with the LeftJoin proxy model.
    • Follows what was done for Tokens, complexity is not too high, so I'd like to do this.

@status-im-auto
Copy link
Member

status-im-auto commented Feb 13, 2024

Jenkins Builds

Click to see older builds (16)
Commit #️⃣ Finished (UTC) Duration Platform Result
ca07f71 #1 2024-02-13 15:03:45 ~5 min macos/aarch64 📄log
✔️ ca07f71 #1 2024-02-13 15:04:29 ~6 min tests/nim 📄log
ca07f71 #1 2024-02-13 15:08:06 ~10 min linux/x86_64 📄log
ca07f71 #1 2024-02-13 15:08:38 ~10 min macos/x86_64 📄log
✔️ ca07f71 #1 2024-02-13 15:09:17 ~11 min tests/ui 📄log
✔️ 1759c77 #2 2024-02-13 15:15:49 ~6 min tests/nim 📄log
✔️ 1759c77 #2 2024-02-13 15:16:29 ~7 min macos/aarch64 🍎dmg
✔️ 1759c77 #2 2024-02-13 15:16:36 ~7 min macos/x86_64 🍎dmg
✔️ 1759c77 #2 2024-02-13 15:19:13 ~9 min tests/ui 📄log
✔️ 1759c77 #2 2024-02-13 15:25:30 ~16 min linux/x86_64 📦tgz
✔️ 1759c77 #2 2024-02-13 15:45:47 ~36 min windows/x86_64 💿exe
✔️ 8c4cb41 #3 2024-02-16 16:56:00 ~5 min macos/aarch64 🍎dmg
✔️ 8c4cb41 #3 2024-02-16 16:57:19 ~6 min tests/nim 📄log
✔️ 8c4cb41 #3 2024-02-16 16:58:32 ~7 min macos/x86_64 🍎dmg
✔️ 8c4cb41 #3 2024-02-16 17:02:40 ~11 min tests/ui 📄log
✔️ 8c4cb41 #3 2024-02-16 17:05:28 ~14 min linux/x86_64 📦tgz
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ feac74d #4 2024-02-16 17:13:38 ~4 min macos/aarch64 🍎dmg
✔️ feac74d #4 2024-02-16 17:15:17 ~6 min tests/nim 📄log
✔️ feac74d #4 2024-02-16 17:16:08 ~7 min macos/x86_64 🍎dmg
✔️ feac74d #4 2024-02-16 17:19:32 ~10 min tests/ui 📄log
✔️ feac74d #4 2024-02-16 17:25:19 ~16 min linux/x86_64 📦tgz
✔️ feac74d #4 2024-02-16 17:34:26 ~25 min windows/x86_64 💿exe
✔️ acce277 #5 2024-02-16 18:19:22 ~4 min macos/aarch64 🍎dmg
✔️ acce277 #5 2024-02-16 18:21:18 ~6 min tests/nim 📄log
✔️ acce277 #5 2024-02-16 18:22:04 ~7 min macos/x86_64 🍎dmg
✔️ acce277 #5 2024-02-16 18:24:47 ~10 min tests/ui 📄log
✔️ acce277 #5 2024-02-16 18:29:27 ~14 min linux/x86_64 📦tgz
✔️ acce277 #5 2024-02-16 18:35:56 ~21 min windows/x86_64 💿exe

@dlipicar dlipicar force-pushed the feat/13254-granular-collectibles-model-updates branch from ca07f71 to 1759c77 Compare February 13, 2024 15:09
Copy link
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

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

Looks good in general, just some smaller issues

src/app/modules/shared_models/collectibles_model.nim Outdated Show resolved Hide resolved
src/app/modules/shared_models/collectibles_model.nim Outdated Show resolved Hide resolved
src/app/modules/shared_models/collectibles_model.nim Outdated Show resolved Hide resolved
for idx in oldIndicesToRemove:
let updatedIdx = idx - removedItems
self.removeCollectibleItem(updatedIdx)
removedItems += 1
Copy link
Member

Choose a reason for hiding this comment

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

Why are you counting the removedItems?

Copy link
Contributor Author

@dlipicar dlipicar Feb 16, 2024

Choose a reason for hiding this comment

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

oldIndicesToRemove holds the indices of the original list in ascending order. Every time we delete an item from the list, we should subtract 1 from the remaining indices in oldIndicesToRemove. Instead of doing that I just keep track of how many items I've removed and do updatedIdx = idx - removedItems.

Copy link
Contributor

@noeliaSD noeliaSD left a comment

Choose a reason for hiding this comment

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

LGTM! And nice to have test included!!

@dlipicar dlipicar force-pushed the feat/13254-granular-collectibles-model-updates branch from 1759c77 to 8c4cb41 Compare February 16, 2024 16:50
@dlipicar dlipicar requested a review from caybro February 16, 2024 16:51
@dlipicar dlipicar force-pushed the feat/13254-granular-collectibles-model-updates branch from 8c4cb41 to feac74d Compare February 16, 2024 17:08
@anastasiyaig
Copy link
Contributor

@dlipicar i will check on failed tests on monday first thing. For now i see that some locator is missing for editing community, not sure what happens (it was passing today against master many times)

Copy link
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

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

👍

@dlipicar dlipicar force-pushed the feat/13254-granular-collectibles-model-updates branch from feac74d to acce277 Compare February 16, 2024 18:14
@dlipicar dlipicar merged commit 48f8fb3 into master Feb 16, 2024
8 checks passed
@dlipicar dlipicar deleted the feat/13254-granular-collectibles-model-updates branch February 16, 2024 18:40
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.

Extend collectibles model notifications to the view
6 participants