Fix intermittent blank price cells in offer book view #4420
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replace faulty cell update logic, which uses a
ChangeListener<Scene>
, added in July 2017 (#73f21399) to keep the price column in the offer book table up to date, as it appears to occasionally result in blank cells. Also it seems only the prices, not the volumes, were being kept in sync with the market price feed.Make the price and volume cells stateless and keep them in sync with the market feed by adding it as a dependency of each
OfferBookListItem
Observable generated by the cell value factory, instead of directly attaching listeners to it. In this way,TableCell::updateItem
will be called by the framework whenever the price/volume needs updating.(This does have the disadvantage that if the price feed is unavailable, causing
Offer::getPrice
to return null, then the cells will reflect that immediately instead of showing any old, stale values, but that is necessary for the UI to behave consistently anyway.)--
This is to fix issues like the following, that I have occasionally observed in the Sell Bitcoin offer book, filtered for BSQ (though never in the Buy Bitcoin offer book or for other counter currencies for some reason):