enso-org / enso

Hybrid visual and textual functional programming.
https://enso.org
Apache License 2.0
7.31k stars 317 forks source link

Offline Mode Support #10317

Closed MrFlashAccount closed 1 week ago

MrFlashAccount commented 1 week ago

Pull Request Description

Tl;dr 

Closes: enso-org/cloud-v2#1283 This PR significantly reimplements Offline mode

Demo Presentation

https://github.com/enso-org/enso/assets/61194245/752d0423-9c0a-43ba-91e3-4a6688f77034


Context:

Offline mode is one of the core features of the dashboard. Unfortunately, after adding new features and a few refactoring, we lost the ability to work offline. This PR should bring this functionality back, with a few key differences:

  1. We require users to sign in before using the dashboard even in local mode.
  2. Once a user is logged in, we allow him to work with local files
  3. If a user closes the dashboard, and then open it, he can continue using it in offline mode

This Change:

What does this change do in the larger context? Specific details to highlight for review:

  1. Reimplements <AuthProvider /> functionality, now it implemented on top of <Suspense /> and ReactQuery
  2. Reimplements Backend module flow, now remote backend is always created, You no longer need to check if the RemoteBackend is present
  3. Introduces new <Suspense /> component, which is aware of offline status
  4. Introduce new offline-related hooks
  5. Add a banner to the form if it's unable to submit it offline
  6. Refactor InviteUserDialog to the new <Form /> component
  7. Fixes redirect bug when the app doesn't redirect a user to the dashboard after logging in
  8. Fixes strange behavior when /users/me could stuck into infinite refetch
  9. Redesign the Cloud table for offline mode.
  10. Adds blocking UI dialog when a user clicks "log out" button

Test Plan:

This PR requires thorough QA on the login flow across the browser and IDE. All redirect logic must stay unchanged.


Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

MrFlashAccount commented 1 week ago

i guess the current plan is to fix the logout issue in this PR instead? i guess it depends on when this PR is expected to be ready

Yeah, I added a Dialog in this PR. @PabloBuchu would you like to take a look?

PabloBuchu commented 1 week ago
  1. Starting local projects after I disconnect from network doesnt work! It comes back after I reconnect.

https://github.com/enso-org/enso/assets/2855109/5506db0c-4b93-4fca-b0a1-5b1c948104db

  1. Reopening in offline shows empty cloud dashboard with bunch of errors "Failed to fetch". It should alaways land on local view

    Screenshot 2024-06-20 at 10 16 13
  2. When I run npm run dev in app/gui2 then disconnect I still can browser cloud / recent / trash with errors

Screenshot 2024-06-20 at 10 20 14
MrFlashAccount commented 1 week ago

This is not how it is supposed to work in my head. Maybe I broke something during the refactoring? Will take a look!

PabloBuchu commented 1 week ago

Two major issues:

  1. Running local project after disconnecting is impossible (although all comes back after connecting back to the network)

https://github.com/enso-org/enso/assets/2855109/a578e568-6065-4151-bd7d-a7731bacda30

  1. When the credentials are there I should be able to use Enso with local only backend Screenshot 2024-06-20 at 16 09 47 Screenshot 2024-06-20 at 16 09 50
MrFlashAccount commented 1 week ago

@PabloBuchu Hi! fixed both bugs.