Commit d29d949
Fix probability slider bugs by using direct node ID lookups (#4)
Fixed two related bugs:
1. Setting slider to 0% displayed correctly on arrows but calculated as 50% downstream
2. Upgrading intermediate nodes to question nodes didn't affect downstream calculations
Root cause: Array-based slider indexing was using questionNodeIndices.indexOf()
which found the wrong position when node indices didn't align with slider indices.
Changes:
- Replace sliderProbs array with Map<string, number> keyed by node ID
- Remove buggy questionNodeIndices.indexOf() lookup
- Use direct map lookup: nodeIdToProb.get(sourceNode.id)
- Fix falsy value bug: change || to ?? so 0 is treated as valid value
- Keep sliderIndex field for sidebar visual sorting only
Both bugs now resolved and tested.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <[email protected]>1 parent cb45ff5 commit d29d949
1 file changed
+9
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
| 102 | + | |
| 103 | + | |
104 | 104 | | |
105 | | - | |
106 | | - | |
| 105 | + | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
150 | 151 | | |
151 | | - | |
152 | | - | |
| 152 | + | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | | - | |
156 | | - | |
157 | 156 | | |
158 | 157 | | |
159 | 158 | | |
| |||
0 commit comments