Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite event_to_object package #1196

Open
Archmonger opened this issue Feb 14, 2024 · 0 comments
Open

Rewrite event_to_object package #1196

Archmonger opened this issue Feb 14, 2024 · 0 comments
Labels
priority-1-high Should be resolved ASAP. release-minor Warrents a minor release type-bug About something that isn't working type-refactor About improving code structure. type-revision About a change in functionality or behavior

Comments

@Archmonger
Copy link
Contributor

Archmonger commented Feb 14, 2024

Current Situation

Right now we need to manually declare everything that gets serialized on our front end.

This is primarily to prevent infinite recursive serialization of events.

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.

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.

@Archmonger Archmonger added type-bug About something that isn't working priority-1-high Should be resolved ASAP. type-revision About a change in functionality or behavior type-refactor About improving code structure. release-minor Warrents a minor release labels Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-1-high Should be resolved ASAP. release-minor Warrents a minor release type-bug About something that isn't working type-refactor About improving code structure. type-revision About a change in functionality or behavior
Projects
None yet
Development

No branches or pull requests

1 participant