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

Fix: Retain Current Page in UUID Table During Lazy Loading #142

Closed

Conversation

TeachMeTW
Copy link
Contributor

@TeachMeTW TeachMeTW commented Oct 10, 2024

This pull request fixes issue #129, where the UUID table did not retain the user's current page during lazy loading updates. With this fix, the page now stays on the user's current page even as new data is loaded.

Problem

Previously, when lazy loading was in progress, navigating through the UUID table would reset the user back to the first page upon each data update. This disrupted the user experience, especially when trying to review data in real-time before the entire dataset was loaded.

Solution

  • Tracked the user's current page state during lazy loading.
  • Modified the data update mechanism to retain the current page without resetting to page one.
  • Ensured that navigation remains uninterrupted during data loading.

Impact

  • User Experience: Improved, as users can now navigate the table without being forced back to the first page.
  • Usability: Enhanced, allowing users to browse and explore data seamlessly during lazy loading.

Testing

  • Verified that the current page is retained during data updates.
  • Tested across various use cases to ensure consistent behavior during lazy loading.
  • Confirmed that navigation works smoothly even when the dataset is still loading.
8mb.video-VqM-0kSE84XU.mp4

Closes: Fixes #129

@TeachMeTW
Copy link
Contributor Author

The loggings are an artifact from a different branch, not sure why it stayed; can remove if needed.

@TeachMeTW TeachMeTW force-pushed the fix/loading-placement branch from 80d3e3f to dc80bc1 Compare October 15, 2024 20:30
@TeachMeTW
Copy link
Contributor Author

Removed unnecessary logging

@TeachMeTW
Copy link
Contributor Author

@JGreenlee Please Review

Comment on lines -292 to +298
page_current=0, # page number that user is on
page_current=page_current, # set to current page
Copy link
Contributor

@JGreenlee JGreenlee Oct 18, 2024

Choose a reason for hiding this comment

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

Note to self: this is basically the fix. Instead of this always being 0, we keep track of page_current and pass it in here

Comment on lines +25 to +34
dcc.Tabs(
id="tabs-datatable",
value='tab-uuids-datatable',
children=[
dcc.Tab(label='UUIDs', value='tab-uuids-datatable'),
dcc.Tab(label='Trips', value='tab-trips-datatable'),
dcc.Tab(label='Demographics', value='tab-demographics-datatable'),
dcc.Tab(label='Trajectories', value='tab-trajectories-datatable'),
]
),
Copy link
Contributor

@JGreenlee JGreenlee Oct 18, 2024

Choose a reason for hiding this comment

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

formatting-only change, but acceptable

Comment on lines +120 to +124
def render_content(
tab, store_uuids, store_excluded_uuids, store_trips, store_demographics, store_trajectories,
start_date, end_date, timezone, n_intervals, key_list, current_page,
loaded_uuids_store, all_data_loaded
):
Copy link
Contributor

@JGreenlee JGreenlee Oct 18, 2024

Choose a reason for hiding this comment

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

I see; current_page added here so it can be used below

Copy link
Contributor

@JGreenlee JGreenlee left a comment

Choose a reason for hiding this comment

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

Looks like a fairly straightforward fix, along with some other logging and comment cleanups

pages/data.py Outdated Show resolved Hide resolved
pages/data.py Outdated Show resolved Hide resolved
pages/data.py Outdated Show resolved Hide resolved
TeachMeTW and others added 3 commits October 18, 2024 12:19
Co-authored-by: Jack Greenlee <[email protected]>
Co-authored-by: Jack Greenlee <[email protected]>
Co-authored-by: Jack Greenlee <[email protected]>
html.Div(id='tabs-content'),
dcc.Store(id='selected-tab', data='tab-uuids-datatable'), # Store to hold selected tab
dcc.Interval(id='interval-load-more', interval=20000, n_intervals=0), # default loading at 10s, can be lowered or hightened based on perf (usual process local is 3s)
dcc.Interval(id='interval-load-more', interval=24000, n_intervals=0), # Interval for loading more data
Copy link
Contributor

Choose a reason for hiding this comment

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

Interval increased; ok for now until we implement a better solution that is not as fragile and does not depend on an arbitrary "magic number"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Tasks completed
Development

Successfully merging this pull request may close these issues.

UUID Table Does Not Retain Current Page During Lazy Loading in Data Tab
3 participants