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

Search in Xstate #39

Merged
merged 16 commits into from
Nov 14, 2024

Conversation

spaceo
Copy link
Contributor

@spaceo spaceo commented Nov 8, 2024

This PR is showing how the search functionality with url param handling and infinite scroll can be implemnted in Xstate.

Things I like about this approach:

Negative parts

  • It is a matter of how you look at it. There is more lines of code in this approach but I like the full control of state transitions and data mutation
  • There is a learning curve for newcomers to Xstate. But I think this work explains a lot of the principles.

@spaceo spaceo force-pushed the DDFBRA-180-implementer-xstate-som-state-manager-i-sogning branch from 3cde3d1 to b88a24c Compare November 8, 2024 19:11
And make sure it is just called once on every filter toggle
@spaceo spaceo force-pushed the DDFBRA-180-implementer-xstate-som-state-manager-i-sogning branch from 04bca93 to e5c46ae Compare November 10, 2024 12:37
components/pages/searchPageLayout/helper.ts Show resolved Hide resolved
components/pages/searchPageLayout/helper.ts Show resolved Hide resolved
components/shared/searchFilters/helper.ts Show resolved Hide resolved
components/pages/searchPageLayout/helper.ts Show resolved Hide resolved
components/shared/searchFilters/helper.ts Show resolved Hide resolved
lib/machines/search/search.machine.setup.ts Outdated Show resolved Hide resolved
lib/machines/search/search.machine.setup.ts Outdated Show resolved Hide resolved
lib/machines/search/search.machine.ts Show resolved Hide resolved
lib/machines/search/search.machine.ts Outdated Show resolved Hide resolved
lib/machines/search/useSearchMachineActor.tsx Show resolved Hide resolved
@spaceo spaceo force-pushed the DDFBRA-180-implementer-xstate-som-state-manager-i-sogning branch from 56743e2 to ef298be Compare November 14, 2024 23:41
+ Made sure that "Viser resulatter for:" only is showing query when a
new a query has been submitted
+ Handle when the search field is being emptied completely: both context
and search params are updated
+ Hardened the bootstarp phase
@spaceo spaceo force-pushed the DDFBRA-180-implementer-xstate-som-state-manager-i-sogning branch from ef298be to dae93ae Compare November 14, 2024 23:42
@spaceo spaceo merged commit fd4388a into main Nov 14, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants