Skip to content

fix: not all provinces data loaded in AreaSelectors#34

Merged
fityannugroho merged 4 commits intomainfrom
fix/default-query
Nov 3, 2024
Merged

fix: not all provinces data loaded in AreaSelectors#34
fityannugroho merged 4 commits intomainfrom
fix/default-query

Conversation

@fityannugroho
Copy link
Owner

@fityannugroho fityannugroho commented Nov 3, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

Put [x] to check

  • I have read the documentation.
  • I have read and followed the Contributing Guidelines.
  • I have included a pull request description of my changes.
  • I have included the necessary changes to the documentation.
  • I have added tests to cover my changes.

PR Type

What kind of change does this PR introduce?

Please check any kind of changes that applies to this PR using [x]

  • Bug fix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes

What is the current behavior?

Please describe the current behavior that you are modifying, or link to a relevant issue.

Issue Number: N/A

  • Not all provinces are loaded in Provice selector (only load 10 provinces).

What is the new behavior?

This pull request introduces a new utility function and refactors the AreaSelectors component to improve code readability and maintainability. The most important changes include adding the objectFromEntries function and refactoring the query state initialization in AreaSelectors.

New Utility Function:

  • lib/utils.ts: Added the objectFromEntries function to convert an array of key-value pairs into an object. ([lib/utils.tsR15-R20](https://github.com/fityannugroho/idn-area-map/pull/34/files#diff-98e56006aa8453a29bc2b8bc8e6f718b3f17ba66470f3a52a5dc5bd643482e70R15-R20))

Refactoring:

  • modules/MapDashboard/AreaSelectors.tsx: Updated imports to include the new objectFromEntries function. ([modules/MapDashboard/AreaSelectors.tsxL5-R10](https://github.com/fityannugroho/idn-area-map/pull/34/files#diff-5b6caf9b06377fde132cc68d7700b2054f6f92ff966f11d60be387521e2b3babL5-R10))
  • modules/MapDashboard/AreaSelectors.tsx: Refactored the initialization of the query state to use the new objectFromEntries function, improving readability and reducing redundancy. ([modules/MapDashboard/AreaSelectors.tsxR29-R53](https://github.com/fityannugroho/idn-area-map/pull/34/files#diff-5b6caf9b06377fde132cc68d7700b2054f6f92ff966f11d60be387521e2b3babR29-R53))

Other information

None

- Add `objectFromEntries` utility function
@fityannugroho fityannugroho added the bug Something isn't working label Nov 3, 2024
@vercel
Copy link

vercel bot commented Nov 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
idn-area-map ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 3, 2024 3:49pm

@fityannugroho fityannugroho changed the title fix: default query initialization in `AreaSelectors fix: not all data loaded in AreaSelectors Nov 3, 2024
@fityannugroho fityannugroho changed the title fix: not all data loaded in AreaSelectors fix: not all provinces data loaded in AreaSelectors Nov 3, 2024
Build fails without it, but linter not complains (idk why, maybe because of different TS or Node version)
@fityannugroho fityannugroho merged commit 5ec15a3 into main Nov 3, 2024
@fityannugroho fityannugroho deleted the fix/default-query branch November 3, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant