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

fix(FEC-12792): UppperBarMangager.update() & sidePangesManager.update() API fails sometimes #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["@typescript-eslint", "prettier"],
"plugins": ["@typescript-eslint"],
"rules": {
"react/prefer-stateless-function": "off",
"max-len": ["warn", { "code": 130 }],
"max-len": ["warn", { "code": 160 }],
"eol-last": "off",
"prettier/prettier": "error",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": "error",
Expand Down
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

10 changes: 8 additions & 2 deletions src/services/side-panels-manager/models/item-wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { h, createRef, RefObject, FunctionalComponent, ComponentClass } from 'preact';
import { KalturaPlayer } from 'kaltura-player-js';
import { KalturaPlayer, PlaykitJS } from 'kaltura-player-js';
Copy link
Contributor

Choose a reason for hiding this comment

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

where is PlaykitJS set ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@JonathanTGold
@SivanA-Kaltura

we do not need to use '@playkit-js/kaltura-player-js'?

import { PanelItemWrapper } from '../ui/panel-item-wrapper/panel-item-wrapper.component';
import { PanelComponentProps, SidePanelItem } from './side-panel-item';
import { UpperBarManager } from '../../upper-bar-manager/upper-bar-manager';
import { pluginName } from '../../../ui-managers';

/**
* Panel item metadata
* @internal
*/
export class ItemWrapper {
private static nextId = 0;
private static logger = PlaykitJS.getLogger(pluginName);
public readonly id: number;
public iconId: number | undefined;
public readonly item: SidePanelItem;
Expand Down Expand Up @@ -58,7 +60,11 @@ export class ItemWrapper {
}

public update(): void {
this.panelItemComponentRef.current!.forceUpdate();
if (this.panelItemComponentRef.current) {
this.panelItemComponentRef.current.forceUpdate();
} else {
ItemWrapper.logger.warn(`Panel component of label: ${this.item.label} id: ${this.id} can not be force updated because the component ref is not set yet`);
}
}

private injectPanelComponent(): void {
Expand Down
9 changes: 8 additions & 1 deletion src/services/upper-bar-manager/models/icon-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { IconDto } from './icon-dto';
import { IconWrapper } from '../ui/icon-wrapper/icon-wrapper.component';
import { SvgIcon } from './svg-icon';
import { KalturaPluginNames } from '../../../types/ui-managers-config';
import { PlaykitJS } from 'kaltura-player-js';
Copy link
Contributor

Choose a reason for hiding this comment

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

need here @playkit-js prefix?

import { pluginName } from '../../../ui-managers';

export class IconModel {
private static nextId = 0;
private static logger = PlaykitJS.getLogger(pluginName);
public readonly id: number;
public label: KalturaPluginNames | string;
public componentRef: RefObject<IconWrapper>;
Expand All @@ -22,6 +25,10 @@ export class IconModel {
}

public update(): void {
this.componentRef.current!.forceUpdate();
if (this.componentRef.current) {
this.componentRef.current.forceUpdate();
} else {
IconModel.logger.warn(`Icon component of label: ${this.label} id: ${this.id} can not be force updated because the component ref is not set yet`);
}
}
}