`db.type() is deprecated` warning because `._remote` is not properly initialized when using multiple database.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
- Lĩnh vực
- database
Hướng nghiên cứu
Bắt đầu với packages/node_modules/pouchdb-utils/src/isRemote.js và theo dõi cách _remote được khởi tạo cho instance cơ sở dữ liệu đầu tiên và các instance tiếp theo. Chạy reproduction được liên kết hoặc các lệnh trong issue; hoàn tất khi db2._remote là false và việc gọi createIndex không còn phát ra cảnh báo deprecation.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This is a re-file of https://github.com/pouchdb/pouchdb/issues/7675 with a repro. This may also be the cause of other issue such as #6477 and #8971.
Issue
Consider the following code:
import PouchDB from "pouchdb";
import PouchDBFind from "pouchdb-find";
PouchDB.plugin(PouchDBFind);
const db1 = new PouchDB("db-1");
console.log(db1._remote); // expected: `false`, observed: `false`
const db2 = new PouchDB("db-2");
console.log(db2._remote); // expected: `false`, observed: `undefined`
// Triggers a warning.
db2.createIndex({
index: { fields: ["some_field"] },
});
This causes the following output
false
undefined
[console warning] db.type() is deprecated and will be removed in a future version of PouchDB
The second line should be false rather than undefined, same as the first line.
This warning is logged from:
The code in question checks whether the DB's _remote field is a boolean. As the second database is not properly initialized with this field, it triggers the deprecation check.
Info
- Environment: Browser
- Platform: Chrome
- Adapter: IndexedDB (default)
- Server: N/A
Reproduce
To run the reproduction case from above, use the following commands:
git clone https://github.com/lgarron/pouchdb-deprecation-warning-repro && cd pouchdb-deprecation-warning-repro
npm install # note: this is slow!
node script/dev.js
- Ngôn ngữ chính
- JavaScript
- Star
- 17.6k
- Fork
- 1.5k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/pouchdb
-
elemMatch throws TypeError: value is null if array has null elementCó thể đã có người làm @henyanagar đã nhận 144 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
unref event is not documentedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Validate database namesĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
Tất cả issue của apache/pouchdb
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 87/100
OWASP/CheatSheetSeries#2905 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ComposioHQ/composio#5249 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
zilliztech/memsearch#838 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[DOCS] Nine one-colon directives hide code examples and notes in the reference docs (e.g. CustomJS)Đang mởTRIAGE
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
cdx-audit output written to a pipe is cut off at 64 KiBCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug mode:cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày