Skip to content

为什么同样的数据库数据,思源笔记和调用API解析结果不一致? #14345

Closed
@wish5115

Description

@wish5115

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

测试文件如下

测试-2uHjs4V.sy.zip

导入后,该数据库中有以下几个数据

Image

Image

但在api调用结果中却是

Image

Image

使用的api是 const avApiData = await fetchSyncPost('/api/av/getAttributeView', {"id": avId});

然后,我查看数据json文件,json文件的存储结果是和api调用结果一致的

Image

Image

那么,究竟是思源笔记解析错了?还是存储和api接口错了?

这会导致在代码片段或插件中,使用api或直接读取数据库存储文件时结果和思源笔记渲染结果不一致,给用户带来困扰。

Expected result

期望二者结果一致

Screenshot or screen recording presentation

No response

Version environment

- Version: v.3.1.10
- Operating System: mac14
- Browser (if used):no

Log file

no

More information

No response

Activity

88250

88250 commented on Mar 11, 2025

@88250
Member

getAttributeView 只是返回原始的 av json,如果需要渲染结果请使用 renderAttributeView

wish5115

wish5115 commented on Mar 11, 2025

@wish5115
Author

getAttributeView 只是返回原始的 av json,如果需要渲染结果请使用 renderAttributeView

请教下渲染结果为什么不是按照存储顺序渲染的?是什么或者哪个字段决定了显示顺序?

88250

88250 commented on Mar 11, 2025

@88250
Member

比如设置了排序字段的时候就需要重新计算排序

wish5115

wish5115 commented on Mar 11, 2025

@wish5115
Author

比如设置了排序字段的时候就需要重新计算排序

好的,谢谢D大!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @88250@wish5115

        Issue actions

          为什么同样的数据库数据,思源笔记和调用API解析结果不一致? · Issue #14345 · siyuan-note/siyuan