-
Notifications
You must be signed in to change notification settings - Fork 6
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
Missing map shapes in summary step #791
base: main
Are you sure you want to change the base?
Conversation
Bundle ReportChanges will increase total bundle size by 351 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: @open-formulieren/sdk-esmAssets Changed:
Files in
view changes for bundle: @open-formulieren/sdk-OpenForms-umdAssets Changed:
Files in
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #791 +/- ##
==========================================
- Coverage 83.86% 83.85% -0.01%
==========================================
Files 245 246 +1
Lines 4808 4814 +6
Branches 1279 1280 +1
==========================================
+ Hits 4032 4037 +5
- Misses 747 748 +1
Partials 29 29
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
src/components/Map/LeafletMap.jsx
Outdated
}, | ||
// `featureGroupRef.current` is needed as dependency to make sure that | ||
// the featureGroupRef can be used. | ||
[geoJsonGeometry, featureGroupRef.current] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check these linter warnings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed the setup a bit to 'solve' this issue.
The problem was that the featureGroupRef was set after this useEffect was be called. Resulting in featureGroupRef.current
not being defined/targetable. By adding the featureGroupRef.currect
to the useEffect dependencies, featureGroupRef would trigger the useEffect once when it was defined.
But React doesn't like ref.currect
as dependency, resulting in warnings/errors.
So i've changed the setup by creating a React component that handles the featureGroup updating. With this setup featureGroupRef.currect
isn't needed as a dependency, because now featureGroupRef.current
is set before we use it. This also separates the featureGroup updating functionality from the other map functionality.
Restructured the drawing logic of the map component, ensuring that geoJsonGeometry and the featureGroupRef are available. This also further encapsulates the drawing logic from the more general map functionalities.
8408f1e
to
7d1521a
Compare
Part of open-formulieren/open-forms#5038
Because the geoJsonGeometry is available before the featureGroupRef is set, can the useEffect hook not draw the map shapes.
This fix makes sure that featureGroupRef is set, so that map shapes can be drawn