Skip to content

Commit

Permalink
feat: added filtering for new coming nodes by node type
Browse files Browse the repository at this point in the history
  • Loading branch information
Rassl committed Oct 21, 2024
1 parent f083a8c commit 65a4388
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/stores/useDataStore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,17 @@ export const useDataStore = create<DataStore>()(
console.log(updatedNode)

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / craco-build-run

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/curationTable/curation.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/sourcesTable/sourcesTable.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/admin/topics.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/checkEnv.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/createGeneratedEdges/createGeneratedEdges.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addSource.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/admin/signin.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addWebpage.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/trendingTopics/trendingTopics.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addYoutube.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addTweet.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/seeLatest/latest.cy.ts)

Unexpected console statement

Check warning on line 323 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addNode/addNodeType.cy.ts)

Unexpected console statement
},
addNewNode: (data) => {
const { dataInitial: existingData } = get()
const { dataInitial: existingData, filters } = get()

if (!data?.nodes) {
return
}

const uniqueIncomingNodes = deduplicateByRefId(data.nodes || [])
const nodesFilteredByFilters = filters.node_type.length
? data.nodes.filter((node) => filters.node_type.some((t) => t === node.node_type))
: data.nodes

const uniqueIncomingNodes = deduplicateByRefId(nodesFilteredByFilters || [])
const uniqueIncomingEdges = deduplicateByRefId(data.edges || [])

// Step 2: Existing nodes and links from the current state
Expand Down

0 comments on commit 65a4388

Please sign in to comment.