raycast / extensions

Everything you need to extend Raycast.
https://developers.raycast.com
MIT License
5.34k stars 3.04k forks source link

[Notion] Add new page to top of database #14861

Closed pimvanderheijden closed 2 weeks ago

pimvanderheijden commented 2 weeks ago

Extension

https://www.raycast.com/notion/notion

Description

Would it be possible to add the new page to the top of the database?

Who will benefit from this feature?

anybody using databases, as I think this should have been the default

Anything else?

No response

raycastbot commented 2 weeks ago

Thank you for opening this issue!

🔔 @HenriChabrand @mathieudutour @metakirby5 @thomaslombart @erics118 @bkeys818 @AlexIsMaking @Yakitrak @tleo19 @dariuszpaluch @zsidnam you might want to have a look.

💡 Author and Contributors commands The author and contributors of `notion/notion` can trigger bot actions by commenting: - `@raycastbot close this issue` Closes the issue. - `@raycastbot close as not planned` Closes the issue as not planned. - `@raycastbot rename this issue to "Awesome new title"` Renames the issue. - `@raycastbot reopen this issue` Reopens the issue. - `@raycastbot assign me` Assigns yourself to the issue. - `@raycastbot good first issue` Adds the "Good first issue" label to the issue. - `@raycastbot keep this issue open` Make sure the issue won't go stale and will be kept open by the bot.
zsidnam commented 2 weeks ago

@pimvanderheijden can you clarify what you mean by adding "to the top of the database"? If you are talking about the sort order of the database view, that needs to be set directly on the view. (If your database view is sorted by Created Date DESC, new pages added to the database will appear at the top in that view).

Please let me know if I'm misunderstanding your question, though!

pimvanderheijden commented 2 weeks ago

I'm talking about the row number of the new page, in other words, the new row in the database should have index 0. Notion creates database rows as pages for some reason.

On Thu, 10 Oct 2024 at 15:51, Zac Sidnam @.***> wrote:

@pimvanderheijden https://github.com/pimvanderheijden can you clarify what you mean by adding "to the top of the database"? If you are talking about the sort order of the database view, that needs to be set directly on the view. (If your database view is sorted by Created Date DESC, new pages added to the database will appear at the top in that view).

Please let me know if I'm misunderstanding your question, though!

— Reply to this email directly, view it on GitHub https://github.com/raycast/extensions/issues/14861#issuecomment-2405157095, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFL2SSTHIHDZ3QSVLJ6CQR3Z22A7VAVCNFSM6AAAAABPWHAH3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBVGE2TOMBZGU . You are receiving this because you were mentioned.Message ID: @.***>

zsidnam commented 2 weeks ago

@pimvanderheijden thanks for clarifying 👍 This is expected behavior. The row indices are relative to the sort order of your database view. I think the default sort is "Created Date ASC", so you can change the sort order of your view to "Created Date DESC" if you want newly created database pages to appear at the top of the view.

pimvanderheijden commented 2 weeks ago

It's unsorted I would say and that's why the newest item is on top. It looks like this for me. I created the item on top right now.

image

When I perform the Notion "Create Database Page" command, the item ends up at the bottom image

pimvanderheijden commented 2 weeks ago

To clarify, by "unsorted" I don't mean disordered but I mean the order in which it is stored under the hood, within the database.

zsidnam commented 2 weeks ago

@pimvanderheijden thank you for those screenshots; that was what I needed! I see what you are saying that Notion adds the row to the top of the table if you click the "New" button at the top of the database view and adds it to the bottom if you click the "New" button at the bottom of the view. That is really interesting that they do that, but I'm not seeing any way to control the insertion order from their API. It looks like there is a similar limitation if you create a Notion button that adds a page to a database; the new page always gets added at the bottom. Unfortunately, unless Notion updates the API to give us this ability, you will have to rely on sorting to make sure the newest row is always at the top.

zsidnam commented 2 weeks ago

I read about this a little further and it seems that Notion internally has access to an order property on the view itself, not on the database, which is also what enables manually dragging rows up and down the table views. You can see that this is specific to the view by adding another table view for that database -> the rows will be laid out in order of "Created time" DESC even though they are ordered differently in your original database view.

Notion does not give access to creating/editing views in their API yet, so we won't have this ability.

pimvanderheijden commented 2 weeks ago

Thanks for diving into this. So there is no way currently to get the newly inserted rows in top, correct? That's a pity.

I think we could say it's a UX issue with Notion itself. I noticed it also occurs in the Notion app when you have a bad connection (or are offline). Anyway, interesting topic. Thanks for spending some time on it with me!

On Fri, 11 Oct 2024 at 15:49, Zac Sidnam @.***> wrote:

I read about this a little further and it seems that Notion internally has access to an order property on the view itself, not on the database, which is also what enables manually dragging rows up and down the table views. You can see that this is specific to the view by adding another table view for that database -> the rows will be laid out in order of "Created time" DESC even though they are ordered differently in your original database view.

Notion does not give access to creating/editing views in their API yet, so we won't have this ability.

— Reply to this email directly, view it on GitHub https://github.com/raycast/extensions/issues/14861#issuecomment-2407457987, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFL2SSWJYCF5EYWHJWAJQ2LZ27JPBAVCNFSM6AAAAABPWHAH3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBXGQ2TOOJYG4 . You are receiving this because you were mentioned.Message ID: @.***>

zsidnam commented 2 weeks ago

@raycastbot close this issue