mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Make scrollParentContainer() more robust as it's used in a timeout callback
Example exception: Exception in setTimeout callback: TypeError: Cannot read property 'parentComponent' of null at constructor.scrollParentContainer (cardDetails.js:77) at cardDetails.js:190 at Meteor.EnvironmentVariable.EVp.withValue (meteor.js?hash=857dafb4b9dff17e29ed8498a22ea5b1a3d6b41d:1207) at meteor.js?hash=857dafb4b9dff17e29ed8498a22ea5b1a3d6b41d:588 at meteor.js?hash=857dafb4b9dff17e29ed8498a22ea5b1a3d6b41d:1234 Probably there is a better fix for this.
This commit is contained in:
parent
06515559a6
commit
d5fbd50b76
1 changed files with 8 additions and 1 deletions
|
|
@ -74,11 +74,18 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
scrollParentContainer() {
|
scrollParentContainer() {
|
||||||
const cardPanelWidth = 510;
|
const cardPanelWidth = 510;
|
||||||
const bodyBoardComponent = this.parentComponent().parentComponent();
|
const parentComponent = this.parentComponent();
|
||||||
|
// TODO sometimes parentComponent is not available, maybe because it's not
|
||||||
|
// yet created?!
|
||||||
|
if (!parentComponent) return;
|
||||||
|
const bodyBoardComponent = parentComponent.parentComponent();
|
||||||
//On Mobile View Parent is Board, Not Board Body. I cant see how this funciton should work then.
|
//On Mobile View Parent is Board, Not Board Body. I cant see how this funciton should work then.
|
||||||
if (bodyBoardComponent === null) return;
|
if (bodyBoardComponent === null) return;
|
||||||
const $cardView = this.$(this.firstNode());
|
const $cardView = this.$(this.firstNode());
|
||||||
const $cardContainer = bodyBoardComponent.$('.js-swimlanes');
|
const $cardContainer = bodyBoardComponent.$('.js-swimlanes');
|
||||||
|
// TODO sometimes cardContainer is not available, maybe because it's not yet
|
||||||
|
// created?!
|
||||||
|
if (!$cardContainer) return;
|
||||||
const cardContainerScroll = $cardContainer.scrollLeft();
|
const cardContainerScroll = $cardContainer.scrollLeft();
|
||||||
const cardContainerWidth = $cardContainer.width();
|
const cardContainerWidth = $cardContainer.width();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue