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

withEntitiesSyncToRouteQueryParams fails if only one or two of withEntities Sort, Filter and pagination are present #140

Closed
gabrielguerrero opened this issue Sep 22, 2024 · 1 comment · Fixed by #141
Labels

Comments

@gabrielguerrero
Copy link
Owner

There is a bug in withEntitiesSyncToRouteQueryParams, that makes it have all 3 withEntities Sort, Filter and pagination present, it should work having only one or two
Example failure case

const Store = signalStore(
        withEntities({ entity }),
        withCallStatus({ initialValue: 'loading' }),
        withEntitiesLocalFilter({
          entity,
          defaultFilter: { search: '', foo: 'bar' },
          filterFn: (entity, filter) =>
            !filter?.search ||
            entity?.name.toLowerCase().includes(filter?.search.toLowerCase()),
        }),
        withEntitiesLoadingCall({
          fetchEntities: ({}) => {
            let result = [...mockProducts.slice(0, 40)];
            const total = result.length;
            const response = { entities: result, total };
            return of(response);
          },
        }),
        withEntitiesSyncToRouteQueryParams({ entity }),
      );

Workaround have all 3 local or remote withEntities sort, filter and pagination

gabrielguerrero pushed a commit that referenced this issue Sep 22, 2024
…filter and pagination

A bug in withEntitiesSyncToRouteQueryParams, was making it only work if the store have withEntities
for all 3 sort, filter and pagination, this fix allows to have any one or two

fix #140
gabrielguerrero pushed a commit that referenced this issue Sep 23, 2024
…filter and pagination

A bug in withEntitiesSyncToRouteQueryParams, was making it only work if the store have withEntities
for all 3 sort, filter and pagination, this fix allows to have any one or two

fix #140
Copy link

🎉 This issue has been resolved in version 18.2.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant