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

Update 2.10.0: values jumping between sources #422

Merged
merged 1 commit into from
Jun 4, 2024
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# V 2.10.1
## Fixes
* Values jumping between sources. Fixes #420
# V 2.10.0
## BREAKING CHANGE
* Requires Signal K v2.8+
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mxtommy/kip",
"version": "2.10.0",
"version": "2.10.1",
"description": "An advanced and versatile marine instrumentation package to display Signal K data.",
"license": "MIT",
"author": {
Expand Down
29 changes: 19 additions & 10 deletions src/app/core/services/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ export class DataService implements OnDestroy {
}

public subscribePath(path: string, source: string): Observable<IPathUpdate> {
const entry = this._pathRegister.find(entry => entry.path == path);
if (entry) {
return entry.pathDataUpdate$;
const matchingPaths = this._pathRegister.find(item => item.path === path && item.source === source);
if (matchingPaths) {
return matchingPaths.pathDataUpdate$;
}

let currentValue: string = null;
Expand Down Expand Up @@ -301,13 +301,22 @@ export class DataService implements OnDestroy {
}

// Update path register Subjects with new data
const item = this._pathRegister.find(item => item.path == updatePath);
if (item) {
const pathData: IPathData = {
value: pathItem.pathValue,
timestamp: new Date(pathItem.pathTimestamp)
};
item._pathData$.next(pathData);
const pathRegisterItems = this._pathRegister.filter(item => item.path === updatePath);
if (pathRegisterItems.length) {
const pathData: IPathData = {
value: pathItem.pathValue,
timestamp: new Date(pathItem.pathTimestamp)
};

const defaultSource = pathRegisterItems.find(item => item.source === "default");
if (defaultSource) {
defaultSource._pathData$.next(pathData);
}

const thisSource = pathRegisterItems.find(item => item.source === dataPath.source);
if (thisSource) {
thisSource._pathData$.next(pathData);
}
}

// Push full tree if data-browser or Zones component are observing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ export class ModalPathControlConfigComponent implements OnInit, OnChanges, OnDes
this.pathFormGroup.controls['source'].setValue('default', {onlySelf: true});
}
}
else if (this.pathFormGroup.controls['source'].value != 'default') {
this.pathFormGroup.controls['source'].setValue('', {onlySelf: true});
}
} else if (Object.keys(pathObject.sources).length > 1) {
this.availableSources = Object.keys(pathObject.sources);
if (this.pathFormGroup.controls['source'].value == 'default') {
Expand Down