Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Rewrite event_to_object package #1196

Copy link
Copy link
Open
Open
Copy link
@Archmonger

Description

@Archmonger
Issue body actions

Current Situation

Right now, the event_to_object JS package within this repo manually declares every attribute that is serializable.

This is primarily to prevent infinite recursive serialization of events. As a result, it currently only attempts to serialize pre-defined "safe" attributes.

Related issues

Proposed Actions

Re-write event_to_object to either have a max-depth of something reasonable like 10, or perform serialization in a way that auto-detects recursive behavior, and skips non-serializable objects.

In terms of auto detection, the core idea would be to keep an temporary list of all events that have been serialized, and make sure to not serialize them twice. Here's some quick and dirty psuedocode...

function convert(event){
   let current_objects = []
   for object in event:
      if !(object in current_objects){
         current_objects.add(object)
      }
   ...
}

For things that aren't serializable, we can skip them.

Ref: https://stackoverflow.com/questions/11547672/how-to-stringify-event-object

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority-1-highShould be resolved ASAP.Should be resolved ASAP.release-minorWarrents a minor releaseWarrents a minor releasetype-refactorAbout improving code structure.About improving code structure.type-revisionAbout a change in functionality or behaviorAbout a change in functionality or behavior

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.