Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
viavr-editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIA-VR
viavr-editor
Commits
f0675966
Commit
f0675966
authored
3 weeks ago
by
Samuel Truman
Browse files
Options
Downloads
Plain Diff
Fixed infinite re-render of variable dropdown setting
parents
78700820
19c493cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/Components/BuildDialog/UnityPackageConfigurations.tsx
+5
-5
5 additions, 5 deletions
...src/Components/BuildDialog/UnityPackageConfigurations.tsx
frontend/src/Components/Settings/VariableDropDownSetting.tsx
+6
-5
6 additions, 5 deletions
frontend/src/Components/Settings/VariableDropDownSetting.tsx
with
11 additions
and
10 deletions
frontend/src/Components/BuildDialog/UnityPackageConfigurations.tsx
+
5
−
5
View file @
f0675966
import
{
SettingAccordion
}
from
'
../Settings/SettingAccordion
'
import
{
Setting
}
from
'
../Settings/Setting
'
import
{
value_t
}
from
'
../../@types/Settings
'
import
{
useEffect
,
useState
}
from
'
react
'
import
{
useCallback
,
useEffect
,
useState
}
from
'
react
'
export
const
UnityPackageConfigurations
=
({
packages
})
=>
{
const
[
packageDescriptions
,
setPackageDescriptions
]
=
useState
<
any
[]
>
([])
const
[
visible
,
setVisible
]
=
useState
(
true
)
// used to force redraw, no other purpose
const
loadPackageSettings
=
async
()
=>
{
const
loadPackageSettings
=
useCallback
(
async
()
=>
{
for
(
const
packageDescription
of
packages
)
{
const
packageConfig
=
await
api
.
invoke
(
api
.
channels
.
toMain
.
getPackageSetting
,
packageDescription
.
name
)
if
(
packageConfig
!==
undefined
)
{
...
...
@@ -16,7 +16,7 @@ export const UnityPackageConfigurations = ({ packages }) => {
}
setPackageDescriptions
(
packages
)
setVisible
(
true
)
}
}
,
[
packages
])
const
sendUpdateToBackend
=
async
(
uuid
:
string
,
newValue
:
value_t
)
=>
{
await
api
.
invoke
(
api
.
channels
.
toMain
.
changePackageSetting
,
uuid
,
newValue
)
...
...
@@ -37,11 +37,11 @@ export const UnityPackageConfigurations = ({ packages }) => {
}
init
()
})
}
,
[
packages
,
loadPackageSettings
]
)
const
drawPackageConfig
=
(
packageDescription
)
=>
{
return
<>
{
(
visible
||
true
)
&&
{
(
visible
)
&&
Object
.
entries
(
packageDescription
[
'
configDescription
'
])
.
map
(([
name
,
setting
])
=>
{
const
id
=
packageDescription
[
'
name
'
]
+
'
.
'
+
name
...
...
This diff is collapsed.
Click to expand it.
frontend/src/Components/Settings/VariableDropDownSetting.tsx
+
6
−
5
View file @
f0675966
import
{
Button
,
SelectMenu
}
from
'
evergreen-ui
'
import
{
SettingEntryLabel
}
from
'
../StyledComponents/Preferences/StyledSettings
'
import
{
useEffect
,
useState
}
from
'
react
'
;
import
{
useCallback
,
useEffect
,
useState
}
from
'
react
'
export
const
VariableDropDownSetting
=
({
id
,
uuid
,
label
,
value
,
onChange
})
=>
{
const
[
variables
,
setVariables
]
=
useState
<
object
[]
>
([])
...
...
@@ -12,14 +12,15 @@ export const VariableDropDownSetting = ({ id, uuid, label, value, onChange }) =>
setVariables
(
loadedVariables
||
[])
}
const
updateOptions
=
useCallback
(()
=>
{
setOptions
(
variables
.
map
(
variable
=>
({
label
:
variable
[
"
name
"
],
value
:
variable
[
"
name
"
]
})))
},
[
variables
])
useEffect
(()
=>
{
loadVariables
()
updateOptions
()
})
}
,
[
updateOptions
]
)
function
updateOptions
()
{
setOptions
(
variables
.
map
(
variable
=>
({
label
:
variable
[
"
name
"
],
value
:
variable
[
"
name
"
]
})))
}
const
onSelect
=
(
item
)
=>
{
setSelected
(
item
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment