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

schema search refreshes component #412

Open
nsheff opened this issue Dec 10, 2024 · 2 comments
Open

schema search refreshes component #412

nsheff opened this issue Dec 10, 2024 · 2 comments

Comments

@nsheff
Copy link
Contributor

nsheff commented Dec 10, 2024

when searching for a schema, if you type in something partway, then it submits the search, it refreshes the search box component, resetting the focus, so your typing is no longer in the box.

the search submit should not refresh or change focus from the search box, it should only update the results component.

@nleroy917
Copy link
Member

nleroy917 commented Dec 10, 2024

I believe the issue is this:

const {
  data: schemas,
  isFetching: isLoading,
  error,
} = useAllSchemas({
  limit,
  offset,
  search: searchDebounced,
  order,
  orderBy,
});

const noSchemasInDatabase = schemas?.count === 0;

if (isLoading) { // <----------- Right here
  return (
    <PageLayout title="Browse">
      <div className="w-100">
        <SchemasPagePlaceholder />
      </div>
    </PageLayout>
  );
}

When it searches, isLoading is now true.. so we render a completely different UI, thus you get defocused. A better approach would be to check if we are loading way down below where we actually render the schema cards.

@nleroy917
Copy link
Member

Simple fix, I believe

@sanghoonio sanghoonio self-assigned this Dec 11, 2024
sanghoonio added a commit that referenced this issue Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants