jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.5k stars 4.02k forks source link

loading data 2 and 3 times after item deletion from list in Angular #19859

Closed erencetinkayaceng closed 9 months ago

erencetinkayaceng commented 2 years ago
Overview of the issue

If we change the page after deleting an item from the list. More than one API call is created.

Line 49: https://github.com/erencetinkayaceng/tmp-bug-multiple-request/blob/master/src/main/webapp/app/entities/foo/list/foo.component.ts

My guess is that the "loadFromBackendWithRouteInformations" method causes more than one observer to be created.

sample repo: https://github.com/erencetinkayaceng/tmp-bug-multiple-request

Motivation for or Use Case
Reproduce the error

I uploaded a video because I thought it would be more appropriate. https://www.youtube.com/watch?v=89HpYVmF5c4

Related issues

it's a similar issue : https://github.com/jhipster/generator-jhipster/issues/11768

Suggest a Fix

I don't know if it's the optimal solution, but my solution was to call the "this.queryBackend(this.page, this.predicate, this.ascending)" method instead of the "loadFromBackendWithRouteInformations" method.

JHipster Version(s)
bug-multiple-request@0.0.1-SNAPSHOT /home/workspace/tmp-bug
└── generator-jhipster@7.9.3
JHipster configuration
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "BugMultipleRequest",
    "blueprints": [],
    "buildTool": "maven",
    "cacheProvider": "hazelcast",
    "clientFramework": "angularX",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1664218454248,
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "devServerPort": 4200,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": false,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entities": ["Foo"],
    "entitySuffix": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.9.3",
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "languages": ["en", "fr"],
    "lastLiquibaseTimestamp": 1664218894000,
    "messageBroker": false,
    "microfrontend": false,
    "microfrontends": [],
    "nativeLanguage": "en",
    "otherModules": [],
    "packageName": "com.cruz",
    "pages": [],
    "prodDatabaseType": "mysql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": "8080",
    "serverSideOptions": [],
    "serviceDiscoveryType": "no",
    "skipCheckLengthOfIdentifier": false,
    "skipClient": false,
    "skipFakeData": false,
    "skipUserManagement": false,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": true
  }
}

Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Foo {
  name String required maxlength(50)
}
paginate Foo with pagination
service Foo with serviceClass

Environment and Tools

openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

git version 2.17.1

node: v16.17.0

npm: 8.15.0

Docker version 20.10.18, build b40c2f6

docker-compose version 1.29.2, build 5becea4c

Browsers and Operating System
github-actions[bot] commented 9 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days