Open KingMob opened 6 years ago
Interesting, can you perhaps get a CodePen|Live version running so I can see exactly what you mean?
Thanks!
Sure, check out https://codepen.io/KingMob/pen/paqmJZ
Hey @KingMob, having checked this out...this is kind of by design. Question IDs are not question set specific, they’re global. So when switching to the second panel, the default is set for the ID “first” question ID and when switching back, it will be set for the previous panel. Does that make sense?
Uhh...not really. Why would the default for a question ever be used once I've chosen an actual answer? When people hit "back", they expect to see the same panel they just left.
Correct, but as the developer you should be having unique questionId
s then this issue will be resolved. :)
Ahh, I hadn't even noticed the CodePen questionId was duplicated. Unfortunately... I checked my real code, and there's no duplicate questionIds there.
I think I may have introduced a bug in the CodePen that's not related to the original issue. See this updated Codepen for an example where the conditional question doesn't appear when you go back: https://codepen.io/KingMob/pen/RMbVoM And if you comment out the default
property, the conditional question appears correctly when going back.
(I suppose it's also possible I had two issues at once. E.g., some copy-and-paste and didn't notice I hadn't fully changed the copied question.)
Ah, okay this shows the bug! Reopening, CodePen v2 helps show the problem at hand.
I'm not sure what's happening, but I know it affects master. Visually, the correct radio option will be chosen, but any conditional questions that are supposed to appear based on it won't appear. The questionAnswers become incorrect when I go back, too, even though I didn't change the answer.
I can confirm that removing the default value fixes the issue, too. Without a default, the props and state match, but with a default, they don't have to.