question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Design Proposal: IsViewCacheEnabled Improvements

See original GitHub issue

Recently we’ve encountered a weird bug https://github.com/AndreiMisiukevich/CardView/issues/225. It turned out that the IsViewCacheEnabled flag is working not like we were expecting and there are potential issues with the current implementation.

Current implementation

When the IsViewCacheEnabled is set to false, the lib creates multiple view instances of the same card. All these instances are bound to the same model and listen for updates. This is not efficient from the memory and performance points of view and in rear cases, like in https://github.com/AndreiMisiukevich/CardView/issues/225, leads to crashes.

Proposal

At any point of time there should be only one view instance for a certain card. E.g. if the user views the card with the index 2, there are 3 views created: for indices 1, 2, 3 (in case if we need one prev/next cards). So:

PrevView: 1 Current: 2 NextView: 3

When the user navigates to the card with the index 3, the lib destroys the view for the index 1, reuses the view 2 for the PrevView, reuses the view 3 as the Current and creates a new view for the index 4.

[Unbound and destroyed] 1 PrevView: 2 (reused) Current: 3 (reused) NextView: 4 (newly created)

If the user navigates back to the second card - the view 4 is destroyed and the view 1 is created. And so on.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
vecalioncommented, Jul 10, 2019

Nah, IMO it’s better to omit that value. So the lib can have it’s own enum that mimics the first two options from CachingStrategy.

1reaction
AndreiMisiukevichcommented, Jul 9, 2019
public bool IsViewReusingEnabled { get; set; }

i think we should add new property and mark old as obsolete

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Write a Design Proposal that Win Projects - Template
To put it another way, design proposals present prospective clients an idea of the kind of work you're capable of. It showcases how...
Read more >
How to create a winning design proposal with user research
Learn how to write a design proposal document that protects you from a client's goals or expectations of a design.
Read more >
How to Write a Website Redesign Proposal
Begin your proposal with an honest assessment of the limitations of your current site. Do the color palette, typography, and other design ......
Read more >
The 7 sections you need to have in your website design ...
Delivering the cost; Tips and tricks for presenting your proposal. 1. Introducing yourself. Project proposals are supposed to help clients ...
Read more >
29 Sample Proposal Templates and Design Tips
Looking to create a proposal to start selling your products or services ... This template for business proposal has a modern design, using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found