dagster icon indicating copy to clipboard operation
dagster copied to clipboard

[ui] Try to guard against history loop in useQueryPersistedState

Open hellendag opened this issue 5 months ago • 2 comments

Summary & Motivation

Try to avoid the history.replace loop in useQueryPersistedState by bailing out if the query is unchanged.

I think we're ending up in a situation where URL querystring updates are triggering effects that lead to querystring updates, but without any actual changes to the query values. With no guard in place to ensure that we don't hammer history.replace, we just keep calling it. This can lead to an error when fires too much, which can kill the page.

Instead, just skip the history.replace call if the previous query and new query are the same. This is done with a qs.stringify() comparison.

How I Tested These Changes

View Insights, with lots of query params in the URL. Verify that when I change filters, even though the change handler fires a lot, history.replace only fires once.

Changelog [New | Bug | Docs]

Bug:

[ui] Prevent excessive history.replaceState() calls when viewing pages with filters.

hellendag avatar Aug 27 '24 20:08 hellendag