Skip to content

Commit

Permalink
correctly determine the vis instance in all cases (#351)
Browse files Browse the repository at this point in the history
* correctly determine the vis instance in all cases

* pass down to adapter-react-v5 will get an update

* bump adapter-react-v5 version to allow passing instance
  • Loading branch information
foxriver76 authored Feb 3, 2024
1 parent 2c4f5f8 commit f0afe59
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ E.g., if it was used in a menu and the menu is red, the circle would be red.
### **WORK IN PROGRESS**
-->
## Changelog
### **WORK IN PROGRESS**
* (foxriver76) correctly determine the vis instance in all cases

### 2.9.26 (2024-02-02)
* (foxriver76) do not show empty icon category if jquery style selected for jquery button widgets
* (foxriver76) added possibility to hide navigation after selection
Expand Down
2 changes: 2 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ async function generateConfigPage(forceBuild, enabledList) {

const configJs =
`window.isLicenseError = ${isLicenseError};
// inject the adapter instance
window.visAdapterInstance = ${adapter.instance};
// for back compatibility with vis.1 on cloud
window.visConfig = {
"widgetSets": ${JSON.stringify(widgetSets)}
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@devbookhq/splitter": "^1.4.2",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@iobroker/adapter-react-v5": "^4.9.4",
"@iobroker/adapter-react-v5": "^4.9.6",
"@iobroker/type-detector": "^3.0.5",
"@iobroker/types": "^5.0.17",
"@iobroker/vis-2-widgets-react-dev": "^1.0.5",
Expand Down
3 changes: 3 additions & 0 deletions src/src/Runtime.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ class Runtime extends GenericApp {
window.socketUrl = `${window.location.protocol}//${window.location.hostname}${window.socketUrl}`;
}

// for projects starting with numbers, adapter-react extracts wrong instance number, as we have no instance in url explicitly
extendedProps.instance = window.visAdapterInstance;

super(props, extendedProps);

// do not control this state
Expand Down
2 changes: 2 additions & 0 deletions src/src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ import type * as SpeechRecognition from 'dom-speech-recognition';
declare global {
interface Window {
webkitSpeechRecognition?: SpeechRecognition;
/** The vis-2 adapter instance */
visAdapterInstance?: number;
}
}

0 comments on commit f0afe59

Please sign in to comment.