AFFiNE/packages/frontend/electron
Peng Xiao 16488d594c
fix(infra): compatibility fix for space prefix (#4912)
It seems there are some cases that [this upstream PR](https://github.com/toeverything/blocksuite/pull/4747) will cause data loss.

Because of some historical reasons, the page id could be different with its doc id.
It might be caused by subdoc migration in the following (not 100% sure if all white screen issue is caused by it) 0714c12703/packages/common/infra/src/blocksuite/index.ts (L538-L540)

In version 0.10, page id in spaces no longer has prefix "space:"
The data flow for fetching a doc's updates is:
- page id in `meta.pages` -> find `${page-id}` in `doc.spaces` -> `doc` -> `doc.guid`
if `doc` is not found in `doc.spaces`, a new doc will be created and its `doc.guid` is the same with its pageId
- because of guid logic change, the doc that previously prefixed with `space:` will not be found in `doc.spaces`
- when fetching the rows of this doc using the doc id === page id,
  it will return EMPTY since there is no updates associated with the page id

The provided fix in the PR will patch the `spaces` field of the root doc so that after 0.10 the page doc can still be found in the `spaces` map. It shall apply to both of the idb & sqlite datasources.

Special thanks to @lawvs 's db file for investigation!
2023-11-14 14:39:50 +08:00
..
resources fix(electron): update app icons (#4789) 2023-10-31 09:09:42 +00:00
scripts fix(electron): dev reload (#4911) 2023-11-12 03:19:27 +00:00
src fix(infra): compatibility fix for space prefix (#4912) 2023-11-14 14:39:50 +08:00
test refactor(electron): fix vitest and add behavior test (#4655) 2023-10-18 22:14:30 -05:00
.gitignore refactor(infra): directory structure (#4615) 2023-10-18 15:30:08 +00:00
dev-app-update.yml refactor(infra): directory structure (#4615) 2023-10-18 15:30:08 +00:00
forge.config.mjs refactor(infra): directory structure (#4615) 2023-10-18 15:30:08 +00:00
package.json fix(electron): dev reload (#4911) 2023-11-12 03:19:27 +00:00
project.json refactor(infra): directory structure (#4615) 2023-10-18 15:30:08 +00:00
README.md refactor(infra): directory structure (#4615) 2023-10-18 15:30:08 +00:00
tsconfig.json refactor(electron): fix vitest and add behavior test (#4655) 2023-10-18 22:14:30 -05:00
tsconfig.node.json refactor(infra): directory structure (#4615) 2023-10-18 15:30:08 +00:00
tsconfig.test.json refactor(electron): fix vitest and add behavior test (#4655) 2023-10-18 22:14:30 -05:00
vitest.config.ts refactor(electron): fix vitest and add behavior test (#4655) 2023-10-18 22:14:30 -05:00

AFFiNE Electron App

Development

To run AFFiNE Desktop Client Application locally, run the following commands:

# in repo root
yarn install
yarn workspace @affine/native build
yarn dev

# in packages/frontend/electron
yarn generate-assets
yarn dev # or yarn prod for production build

Troubleshooting

Credits

Most of the boilerplate code is generously borrowed from the following