Reduce Data Transfer for State Restore #2872
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a significant change to how screen state is handled. To better understand this, let’s first review the current behavior:
All recorded public properties of the screen are wrapped in a signalizer, which typically increases the length of the data since its contents are serialized:
The data is then encrypted, further increasing the text length:
// Encripted: Tzo3OiJFeGFtcGxlIjoxOntzOjk6InByb3BlcnR5MSI7czo2OiJ2YWx1MSI7czo5OiJwcm9wZXJ0eTIiO3M6Njoi dmFsdWUiO30=
As a result, if a user writes too much data into a public property, such as a model with many relationships, this impacts the length of the response/request. In extreme cases, this can lead to a 413 – Request Entity Too Large error.
To address this issue while retaining functionality, this PR proposes the following change:
Instead of serializing the entire model and its properties, we will serialize the SQL query, similar to how Laravel Queues handle this with the
SerializeModel
trait. This approach will significantly reduce the amount of data transferred, as it avoids storing the complete information. During deserialization, the data will be retrieved again from the database.This change aims to preserve functionality while mitigating the risk of data overload issues.