Skip to content

Fix differ issues from json->edn conversion#7565

Merged
NoahTheDuke merged 2 commits intomtgred:masterfrom
NoahTheDuke:nb/fix-7424-empty-buttons
Jul 17, 2024
Merged

Fix differ issues from json->edn conversion#7565
NoahTheDuke merged 2 commits intomtgred:masterfrom
NoahTheDuke:nb/fix-7424-empty-buttons

Conversation

@NoahTheDuke
Copy link
Collaborator

@NoahTheDuke NoahTheDuke commented Jul 17, 2024

Closes #7424.

Would be handled by #7564 but that's a mess and would break all game histories, so that's on pause.

Differ handles sequential types in a special way, with :+ meaning "insert at the end". Our reliance on json means that it was always being treated as "+" and thus differ would ignore it. I believe this has infected every portion of the entire frontend as long as we've used differ, but it's only surfaced here cuz we tend to ignore nils everywhere lol.

The result of this bug would be that the diff from the waiting prompt to the choices prompt would have :choices ["+" {:value {:title "Overseer Matrix" ...} ...} "+" {:value {:title "Overseer Matrix" ...} ...} "+" {:value {:title "Overseer Matrix" ...} ...} "+" {:value {:title "Yakov Erikovich Avdakov" ...} ...}], and thus be rendered incorrectly because you can't destructure a string. With this fix, it'll now just be the correct values merged in to their right place.

Having written all of this out, I have also updated the prompt-state differ stuff to be smarter, borrowing code from #7564.

#(card-highlight-mouse-out % value button-channel)}
(render-message (or (not-empty (get-title value)) value))]))))]))
(doall (for [{:keys [idx uuid value]} choices
:when (not= value "Hide")]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but we shouldn't return nil anyway.

@NoahTheDuke NoahTheDuke force-pushed the nb/fix-7424-empty-buttons branch from 82e3ce4 to ae5566b Compare July 17, 2024 19:26
@NoahTheDuke NoahTheDuke merged commit 2d7ea55 into mtgred:master Jul 17, 2024
@NoahTheDuke NoahTheDuke deleted the nb/fix-7424-empty-buttons branch July 17, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overseer Matrix' UI shows additionalt blank options

1 participant