@monterosa/sdk-interact-kit 0.18.5 → 0.18.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1648,7 +1648,14 @@ async function handleCreateMessage(message) {
1648
1648
  }
1649
1649
  if (elements.has(options.id)) {
1650
1650
  const element = elements.get(options.id);
1651
- if (options.updated_at > element.updatedAt) {
1651
+ if (options.updated_at > element.updatedAt ||
1652
+ // This is a workaround to handle a Studio issue when two /create/ messages
1653
+ // are sent upon correct option reveal. The first /create/ message contains
1654
+ // the same duration but a different updated_at timestamp. The second /create/
1655
+ // message contains the same updated_at timestamp but a different duration.
1656
+ // Therefore, we need to check if the duration is different to ensure that
1657
+ // the element is updated correctly.
1658
+ options.duration !== element.duration) {
1652
1659
  element.update(options);
1653
1660
  event.emit('update', element);
1654
1661
  }
@@ -1700,8 +1707,10 @@ function handleRevealMessage(message) {
1700
1707
  if (!element) {
1701
1708
  return;
1702
1709
  }
1703
- element.correctOption = correctOption;
1704
- element.context.event.emit('update', element);
1710
+ if (element.correctOption !== correctOption) {
1711
+ element.correctOption = correctOption;
1712
+ element.context.event.emit('update', element);
1713
+ }
1705
1714
  }
1706
1715
  async function handleEventHistory(history) {
1707
1716
  var e_1, _a;