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

refactor(store): Refactor north arrow to use the store and remove api… #1358

Conversation

jolevesq
Copy link
Member

@jolevesq jolevesq commented Oct 4, 2023

… from footer element

Closes #1329

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

Add the URL for your deploy!

Checklist:

  • I have build (rush build) and deploy (rush host) my PR
  • I have connected the issues(s) to this PR
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have created new issue(s) related to the outcome of this PR is needed
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

This change is Reviewable

Copy link
Member

@DamonU2 DamonU2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 21 of 21 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @cphelefu, @jolevesq, and @ychoquet)


packages/geoview-core/src/api/eventProcessors/map-event-process.ts line 51 at r1 (raw file):

        // because emit and on from api events can be trigger in loop, compare also the api value
        if (cur !== prev && api.maps[mapId].currentProjection !== cur!) {
          console.log(`proj emit ${mapId}`);

"Disable no console for this line" to prevent flags?


packages/geoview-core/src/api/eventProcessors/map-event-process.ts line 84 at r1 (raw file):

        // because emit and on from api events can be trigger in loop, compare also the api value
        if (payloadIsAMapViewProjection(payload) && api.maps[mapId].currentProjection !== payload.projection!) {
          console.log(`proj on ${mapId}`);

As above


packages/geoview-core/src/core/components/overview-map/overview-map.tsx line 113 at r1 (raw file):

  /**
   * Return the map ovberview map

ovberview > overview


packages/geoview-core/src/core/stores/stores-managers.ts line 35 at r1 (raw file):

  initializeEventProcessors(geoViewStore);

  console.log('store creation');

Disable no console?


packages/geoview-core/src/geo/map/map.ts line 413 at r1 (raw file):

          this.map.getView().on('change:rotation', store.getState().mapState.onMapRotation);

          console.log('store add map event');

As above

Copy link
Contributor

@cphelefu cphelefu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 21 of 21 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @jolevesq and @ychoquet)

@jolevesq jolevesq force-pushed the 1329-store-north-prev branch from eaa360e to 8c7cab4 Compare October 5, 2023 19:55
Copy link
Member Author

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 7 of 13 files at r2.
Reviewable status: 19 of 25 files reviewed, 5 unresolved discussions (waiting on @cphelefu, @DamonU2, and @ychoquet)


packages/geoview-core/src/api/eventProcessors/map-event-process.ts line 51 at r1 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

"Disable no console for this line" to prevent flags?

Done.


packages/geoview-core/src/api/eventProcessors/map-event-process.ts line 84 at r1 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

As above

Done.


packages/geoview-core/src/core/components/overview-map/overview-map.tsx line 113 at r1 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

ovberview > overview

Done.


packages/geoview-core/src/core/stores/stores-managers.ts line 35 at r1 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

Disable no console?

Done.


packages/geoview-core/src/geo/map/map.ts line 413 at r1 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

As above

Done.

Copy link
Member Author

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 14 of 21 files at r1, 4 of 13 files at r2, all commit messages.
Reviewable status: 23 of 25 files reviewed, 5 unresolved discussions (waiting on @cphelefu, @DamonU2, and @ychoquet)

Copy link
Member

@DamonU2 DamonU2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 13 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ychoquet)

@jolevesq jolevesq force-pushed the 1329-store-north-prev branch 2 times, most recently from fe12955 to f79b1f0 Compare October 6, 2023 16:05
@cphelefu
Copy link
Contributor

cphelefu commented Oct 6, 2023

packages/geoview-core/src/api/eventProcessors/notification-event-process.ts line 15 at r3 (raw file):

    api.event.on(
      EVENT_NAMES.NOTIFICATIONS.NOTIFICATION_ADD,
      (payload: PayloadBaseClass) => {

Why do we have this here? Where do we call this NOTIFICATION_ADD; why didnt we just add it to the store directly from there?

@cphelefu
Copy link
Contributor

cphelefu commented Oct 6, 2023

packages/geoview-core/src/core/components/map/map.tsx line 59 at r3 (raw file):

  // get values from the store
  const { mapLoaded, northArrow, overviewMap } = useStore(getGeoViewStore(mapId), (state) => state.mapState);

This is going to refresh page whenever any property in mapState is changed.
I think it should be (state) => [state.mapState.mapLoaded, state.mapState,northArrow ])..

Something along these lines, confirm in zustand documentation

Copy link
Member Author

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 14 of 14 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ychoquet)

Copy link
Member Author

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @cphelefu and @ychoquet)


packages/geoview-core/src/api/eventProcessors/notification-event-process.ts line 15 at r3 (raw file):

Previously, cphelefu (Christopher Phelefu) wrote…

Why do we have this here? Where do we call this NOTIFICATION_ADD; why didnt we just add it to the store directly from there?

Because this event may be emit by the api from outside the viewer

Copy link
Member Author

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 13 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @cphelefu and @ychoquet)

@jolevesq jolevesq force-pushed the 1329-store-north-prev branch from f79b1f0 to ff002dd Compare October 6, 2023 16:45
Copy link
Member Author

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r4.
Reviewable status: all files reviewed (commit messages unreviewed), 2 unresolved discussions (waiting on @cphelefu and @ychoquet)


packages/geoview-core/src/core/components/map/map.tsx line 59 at r3 (raw file):

Previously, cphelefu (Christopher Phelefu) wrote…

This is going to refresh page whenever any property in mapState is changed.
I think it should be (state) => [state.mapState.mapLoaded, state.mapState,northArrow ])..

Something along these lines, confirm in zustand documentation

Done.

Copy link
Member Author

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @cphelefu and @ychoquet)

Copy link
Contributor

@cphelefu cphelefu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 8 of 13 files at r2, 13 of 14 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ychoquet)

Copy link
Contributor

@cphelefu cphelefu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ychoquet)

Copy link
Member Author

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 21 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ychoquet)

@jolevesq jolevesq merged commit 79f6686 into Canadian-Geospatial-Platform:develop Oct 6, 2023
5 checks passed
@jolevesq jolevesq deleted the 1329-store-north-prev branch December 18, 2023 14:54
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.

[REFACTOR] North Arrow Use Store
3 participants