roamjs / roamjs-components Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
idb is a peer dependency for this project, but linked to version 6.0.0. Version 7 has been stable for a year now, and version 7.1.1 was just released yesterday. This would allow other extensions to more easily use the most recent idb. I currently am having to do npm install --force
to get roamjs-components and idb 7.
Happy to try to make a pr for this, but I didn't see any guidelines for developing or running tests, so figured best to open this. Let me know!
EDIT: more specifically: when a preceding sibling is added to an ancestor block
Example
https://www.loom.com/share/af9dce45fe654b96a56aacb9ee5d60d0
It looks like the cause is n.contains(p)
from renderWithUnmount
const parentRemoved = ms
.flatMap((m) => Array.from(m.removedNodes))
.some((n) => n === p || n.contains(p));
if (parentRemoved) {
unmount(observer);
}
@dvargas92495 , what case is n.contains(p)
solving for that n === p
doesn't?
EDIT: further testing showed that n.contains(p)
is used when a block is being edited or folded
src/date/parseNlpDate.ts call startOfWeek & endOfWeek without the optional parameter weekStartsOn
.
Thus the week start defaults to Sunday sadly which is not the convention followed for much of the world.
Roam stores the setting as can be seen in the Javascript console:
roamAlphaAPI.q('[:find ?settings :where [_ :user/settings ?settings]]')?.[0]?.[0]?.["first-day-of-week"]
I suppose it's best to take the user account setting within that component rather than complicating the extensions that use the library. Though it then makes date parsing code user preferences aware which makes it complex..hmmmm. Thoughts?
tl:dr - fine-grained
tokens result in 403
, using classic
token instead
When creating a PR via
roamjs-components/src/scripts/publishToRoamDepot.ts
Lines 146 to 157 in a03b1b8
Where
owner
= RoamJS
branch
= query-builder
We have been continually getting the following error (latest run with error)
{
message: 'Resource not accessible by personal access token',
documentation_url: 'https://docs.github.com/rest/pulls/pulls#create-a-pull-request',
status: '403'
}
According to the GitHub REST API docs, fine-grained tokens only require "Pull request" write access for this
This endpoint works with the following fine-grained token types:
- GitHub App user access tokens
- GitHub App installation access tokens
- Fine-grained personal access tokens
The fine-grained token must have the following permission set:
- "Pull requests" repository permissions (write)
Yet, even with a Fine-grained token with full read-write to repo/org and access to all repos, we could continually get a 403 error.
I have also replicated this using a VSCode Extension, Thunder Client, with updated headers as per GitHub docs
Others have also reported this issue:
https://github.com/orgs/community/discussions/106661
https://github.com/orgs/community/discussions/123362
@dvargas92495 Build Error. Issue with PullBlock
/ ActionParams
type mismatch.
Error in mockRoamEnvironment.ts
createBlock: async (action) => {
if (!action.block) throw new Error(`block field is required`);
if (!action.location) throw new Error(`location field is required`);
const parent = graph.uids[action.location["parent-uid"]];
if (!parent)
throw new Error(
`Could not find parent by uid: ${action.location["parent-uid"]}`
);
const parentBlock = graph.state[parent];
const id = getDbId();
const block = {
":block/string": action.block.string,
":block/uid":
action.block.uid || window.roamAlphaAPI.util.generateUID(),
":block/parents": ([{ ":db/id": parent }] as PullBlock[]).concat(
parentBlock[":block/parents"] || []
),
":db/id": id,
":block/order": action.location.order,
};
graph.uids[block[":block/uid"]] = id;
parentBlock[":block/children"] = (
parentBlock[":block/children"] || []
).concat({ ":db/id": id });
graph.state[id] = block; // ERROR HERE - Types of property '":block/order"' are incompatible.
},
I tried just adding "last"
to Pullblock, but that gave a bunch of other errors, for instance in getBasicTreeByParentUid
const sortBasicNodes = (c: PullBlock[]): RoamBasicNode[] =>
c
.sort((a, b) => (a[":block/order"] || 0) - (b[":block/order"] || 0))
.map((node) => ({
children: sortBasicNodes(node[":block/children"] || []),
uid: node[":block/uid"] || "",
text: node[":block/string"] || "",
}));
Which makes sense. I image PullBlock doesn't return "last"
.
What is the relationship between ActionParams
and PullBlock
?
Do we create a separate CreateBlock
type?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.