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

Restore react-router error handling #5682

Merged
merged 3 commits into from
May 16, 2024

Conversation

Rheeseyb
Copy link
Contributor

@Rheeseyb Rheeseyb commented May 15, 2024

Problem:
#5676 removed some handling we put in place in #5084 specific for a couple of react-router errors that would cause issues with the canvas.

Fix:
Rather than resurrecting the console proxying code for the sake of this, I've narrowed the logic down to only operate on the console.error method. We then listen for those specific errors (checking the first arg of the function, which is what we were doing previously).

Note:
Unlike before, this will no longer immediately restore the canvas. Some form of action is required to restore the canvas, such as a manual save, or even scrolling the canvas (in the following video I wait a bit before scrolling the canvas to demonstrate this):
https://github.com/concrete-utopia/utopia/assets/1044774/d92e3eba-4d7f-413a-b484-8c34228d0adf
I believe this is because with the previous console proxying we would have re-rendered the canvas after any log line due to the (horrible) way the proxying was wired in.

Manual Tests:
I hereby swear that:

  • I opened a hydrogen project and it loaded
  • I could navigate to various routes in Preview mode

Copy link
Contributor

github-actions bot commented May 15, 2024

Try me

originalMethod(...args)

// If the first part of the log line is a string
const firstLine = args[0]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously we would use console-feed to parse, then encode, then decode (?) the args (https://github.com/concrete-utopia/utopia/pull/5676/files#diff-e3967556a9487a929c1e232412b7704ffd6fb9d427e4722eb2cb2322963f7c56L55-L57), which creates an object used by that library. We would then check the data field of that object, which is just the args array (https://github.com/concrete-utopia/utopia/pull/5676/files#diff-a4c8338855ca2b6cba1cde108cc950253be1063727a563185098bbd573c2bea7L134-L145). So since we no longer need to proxy to a console pane, we don't need to do any of that, and can just check the args directly.

Copy link

relativeci bot commented May 15, 2024

#12469 Bundle Size — 62.15MiB (+0.03%).

6e802d1(current) vs 6339ece master#12464(baseline)

Warning

Bundle contains 52 duplicate packages – View duplicate packages

Bundle metrics  Change 5 changes Regression 2 regressions
                 Current
#12469
     Baseline
#12464
Regression  Initial JS 45.21MiB(+0.04%) 45.19MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 21.31% 21.91%
No change  Chunks 31 31
No change  Assets 34 34
Change  Modules 4278(+0.05%) 4276
Regression  Duplicate Modules 511(+0.39%) 509
Change  Duplicate Code 31.02%(+0.03%) 31.01%
No change  Packages 449 449
No change  Duplicate Packages 52 52
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
#12469
     Baseline
#12464
Regression  JS 62.14MiB (+0.03%) 62.12MiB
Improvement  HTML 10.94KiB (-0.34%) 10.98KiB

Bundle analysis reportBranch fix/restore-react-router-error-h...Project dashboard

Copy link
Contributor

github-actions bot commented May 15, 2024

Performance test results:
(Chart1)
(Chart2)

@Rheeseyb Rheeseyb marked this pull request as ready for review May 15, 2024 11:55
@@ -154,3 +154,62 @@ export function useErrorOverlayRecords(): ErrorOverlayRecords {

return { errorRecords, overlayErrors }
}

function filterOldPasses(errorMessages: Array<ErrorMessage>): Array<ErrorMessage> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've moved this function (without making any changes to it) as it was causing a cyclic dependency in the tests

@Rheeseyb Rheeseyb merged commit 9b752cd into master May 16, 2024
16 checks passed
@Rheeseyb Rheeseyb deleted the fix/restore-react-router-error-handling branch May 16, 2024 09:54
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.

None yet

3 participants